Herramientas de usuario

Herramientas del sitio


notas:linux

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Próxima revisión
Revisión previa
notas:linux [2014/11/13 13:10] – creado cayunotas:linux [2018/11/14 20:16] (actual) cayu
Línea 5: Línea 5:
 ===== Hardware ===== ===== Hardware =====
 ===== Sistema Operativo ===== ===== Sistema Operativo =====
 +=== Generar estructura de directorios del 1 al 12 ===
 +<code bash>
 +mkdir 2010/{01..12}
 +</code>
 +=== Mostrar permisos númericos de archivos ===
 +<code>
 +stat -c "%a %n" *
 +</code>
 +=== Renombrar archivos con _ en vez de espacios ===
 +<code bash>
 +ls | while read -r FILE; do     mv -v "$FILE" `echo $FILE | tr ' ' '_' | tr -d '[{}(),\!]' | tr -d "\'" | tr '[A-Z]' '[a-z]' | sed 's/_-_/_/g'`; done
 +</code>
 +=== Optimizar el formato de un disco USB para archivos grandes ===
 +<code>
 +mkfs -t ext4 -m 0 -O sparse_super -T largefile4 /dev/sdb1
 +echo 1024 > /sys/block/sdb/device/max_sectors
 +</code>
 === Reloading inittab without reboot === === Reloading inittab without reboot ===
  
Línea 22: Línea 39:
 <code> <code>
 rename s/.cfg/.cfg.old/ *.cfg rename s/.cfg/.cfg.old/ *.cfg
-</code> 
- 
-=== Compilar el Kernel a lo Debian === 
- 
-Esto es lo mismo que hacer un //make -j//. 
- 
-<code> 
-export CONCURRENCY_LEVEL=2 
-</code> 
- 
-Despues de hacer el menuconfig le damos el make de esta manera. 
- 
-<code> 
-make-kpkg --initrd --append-to-version=-some-string-here kernel-image kernel-headers kernel-source 
-</code> 
- 
-y listo, vamos a tener dos archivos asi: 
- 
-<code> 
-linux-headers-3.0.6-13-generic_3.0.6-13-generic-10.00.Custom_i386.deb 
-linux-image-3.0.6-13-generic_3.0.6-13-generic-10.00.Custom_i386.deb   
 </code> </code>
  
Línea 514: Línea 510:
 </code> </code>
  
-=== TAB Completion Debian Net Install === 
-<code> 
-apt-get install bash-completion 
-exit 
-login 
-</code> 
  
 === Cambiar cadena de texto dentro de archivos === === Cambiar cadena de texto dentro de archivos ===
Línea 537: Línea 527:
 ipcs -s | grep $USERNAME | awk ' { print $2 } ' | xargs ipcrm sem ipcs -s | grep $USERNAME | awk ' { print $2 } ' | xargs ipcrm sem
 </code> </code>
 +
 +=== Debian ===
 +
 +== TAB Completion Debian Net Install ==
 +<code>
 +apt-get install bash-completion
 +exit
 +login
 +</code>
 +
 +
 +== Compilar el Kernel a lo Debian ==
 +
 +Esto es lo mismo que hacer un //make -j//.
 +
 +<code>
 +export CONCURRENCY_LEVEL=2
 +</code>
 +
 +Despues de hacer el menuconfig le damos el make de esta manera.
 +
 +<code>
 +make-kpkg --initrd --append-to-version=-some-string-here kernel-image kernel-headers kernel-source
 +</code>
 +
 +y listo, vamos a tener dos archivos asi:
 +
 +<code>
 +linux-headers-3.0.6-13-generic_3.0.6-13-generic-10.00.Custom_i386.deb
 +linux-image-3.0.6-13-generic_3.0.6-13-generic-10.00.Custom_i386.deb  
 +</code>
 +
 +
 +== Script para modificar control file de un .deb ==
 +
 +<code bash>
 +    #!/bin/bash
 +
 +    EDITOR=gedit
 +
 +    if [[ -z "$1" ]]; then
 +      echo "Syntax: $0 debfile"
 +      exit 1
 +    fi
 +
 +    DEBFILE="$1"
 +    TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1
 +    OUTPUT=`basename "$DEBFILE" .deb`.modfied.deb
 +
 +    if [[ -e "$OUTPUT" ]]; then
 +      echo "$OUTPUT exists."
 +      rm -r "$TMPDIR"
 +      exit 1
 +    fi
 +
 +    dpkg-deb -x "$DEBFILE" "$TMPDIR"
 +    dpkg-deb --control "$DEBFILE" "$TMPDIR"/DEBIAN
 +
 +    if [[ ! -e "$TMPDIR"/DEBIAN/control ]]; then
 +      echo DEBIAN/control not found.
 +
 +      rm -r "$TMPDIR"
 +      exit 1
 +    fi
 +
 +    CONTROL="$TMPDIR"/DEBIAN/control
 +
 +    MOD=`stat -c "%y" "$CONTROL"`
 +    $EDITOR "$CONTROL"
 +
 +    if [[ "$MOD" == `stat -c "%y" "$CONTROL"` ]]; then
 +      echo Not modfied.
 +    else
 +      echo Building new deb...
 +      dpkg -b "$TMPDIR" "$OUTPUT"
 +    fi
 +
 +    rm -r "$TMPDIR"
 +</code>
 +
 +Ref.: http://ubuntuforums.org/showthread.php?t=636724
 +
 ===== Redes sociales ===== ===== Redes sociales =====
  
notas/linux.1415884257.txt.gz · Última modificación: 2014/11/13 13:10 por cayu