Comandos linux
Comandos básicos:
mkdir: crear carpeta o directorio
rm: Eliminar archivo
rm -r: Elminar carpeta o directorio completo con todos sus archivos de dentro
ls -las: Lista directorio completo con permisos de cada uno de los archivos del directorio
Editando texto
nano: Editor de texto
nano midocumento.txt Editas el documento
CTRL+O : guardar
CTRL-X: salir
vi Editor de texto avanzado para consola
Procesos que están corriendo
ps -aux Lista todos los procesos que están corriendo en el sistema, depende tu privilegio, si eres root veras todos
kill ## -9 Sirve para matar el proceso ##
Buscar un proceso específico usando grep
ps -aux|grep nombreOnumProceso
Busqueda de programas para saber donde esta las carpetas
which programa
whereis programa
Si quieres buscar un archivo de forma recursiva en todas las carpetas
ls -las -R|grep nombreBusqueda
wget : Para bajar archivos desde la web directamente a consola o bajar hasta páginas completas con “wget -r”
ejm:
wget http://www.google.cl/intl/en_com/images/logo_plain.png
wget -r http://....... te crea una carpeta con el nombre del sitio
df: Muestra el espacio usado y restante de cada una de las particiones del disco duro.
bash
Referencia:
Esto se ha extraído íntegramente desde: pagina
Comandos Bash (Bash SyntaxOS X Commands Linux)
Un índice de la A-Z de los comandos BASH para Linux
alias Crea un alias
apropos Search Help manual pages (man -k)
awk Find and Replace text, database sort/validate/index
break Exit from a loop
builtin Run a shell builtin
bzip2 Compress or decompress named file(s)
cal Muestra el calendario(fecha)
case Conditionally perform a command
cat despliega el contenido de un archivo
cd Cambio de directorio
cfdisk Partition table manipulator for Linux
chgrp Change group ownership
chmod Change access permissions
chown Change file owner and group
chroot Run a command with a different root directory
cksum Print CRC checksum and byte counts
clear Clear terminal screen
cmp Compare two files
comm Compare two sorted files line by line
command Run a command – ignoring shell functions
continue Resume the next iteration of a loop
cp Copy one or more files to another location
cron Daemon to execute scheduled commands
crontab Schedule a command to run at a later time
csplit Split a file into context-determined pieces
cut Divide a file into several parts
date Display or change the date & time
dc Desk Calculator
dd Data Dump – Convert and copy a file
declare Declare variables and give them attributes
df Display free disk space
diff Display the differences between two files
diff3 Show differences among three files
dig DNS lookup
dir Briefly list directory contents
dircolors Colour setup for `ls’
dirname Convert a full pathname to just a path
dirs Display list of remembered directories
du Estimate file space usage
echo Display message on screen
egrep Search file(s) for lines that match an extended expression
eject Eject removable media
enable Enable and disable builtin shell commands
env Environment variables
ethtool Ethernet card settings
eval Evaluate several commands/arguments
exec Execute a command
exit Exit the shell
expand Convert tabs to spaces
export Set an environment variable
expr Evaluate expressions
false Do nothing, unsuccessfully
fdformat Low-level format a floppy disk
fdisk Partition table manipulator for Linux
fgrep Search file(s) for lines that match a fixed string
file Determine file type
find Search for files that meet a desired criteria
fmt Reformat paragraph text
fold Wrap text to fit a specified width.
for Expand words, and execute commands
format Format disks or tapes
free Display memory usage
fsck File system consistency check and repair
ftp File Transfer Protocol
function Define Function Macros
gawk Find and Replace text within file(s)
getopts Parse positional parameters
grep Search file(s) for lines that match a given pattern
groups Print group names a user is in
gzip Compress or decompress named file(s)
hash Remember the full pathname of a name argument
head Output the first part of file(s)
history Command History
hostname Print or set system name
id Print user and group id’s
if Conditionally perform a command
ifconfig Configure a network interface
import Capture an X server screen and save the image to file
install Copy files and set attributes
join Join lines on a common field
kill Stop a process from running
less Display output one screen at a time
let Perform arithmetic on shell variables
ln Make links between files
local Create variables
locate Find files
logname Print current login name
logout Exit a login shell
look Display lines beginning with a given string
lpc Line printer control program
lpr Off line print
lprint Print a file
lprintd Abort a print job
lprintq List the print queue
lprm Remove jobs from the print queue
ls List information about file(s)
lsof List open files
make Recompile a group of programs
man Help manual
mkdir Create new folder(s)
mkfifo Make FIFOs (named pipes)
mkisofs Create an hybrid ISO9660/JOLIET/HFS filesystem
mknod Make block or character special files
more Display output one screen at a time
mount Mount a file system
mtools Manipulate MS-DOS files
mv Move or rename files or directories
netstat Networking information
nice Set the priority of a command or job
nl Number lines and write files
nohup Run a command immune to hangups
nslookup Query Internet name servers interactively
passwd Modify a user password
paste Merge lines of files
pathchk Check file name portability
ping Test a network connection
popd Restore the previous value of the current directory
pr Prepare files for printing
printcap Printer capability database
printenv Print environment variables
printf Format and print data
ps Process status
pushd Save and then change the current directory
pwd Print Working Directory
quota Display disk usage and limits
quotacheck Scan a file system for disk usage
quotactl Set disk quotas
ram ram disk device
rcp Copy files between two machines.
read read a line from standard input
readonly Mark variables/functions as readonly
remsync Synchronize remote files via email
return Exit a shell function
rm Remove files
rmdir Remove folder(s)
rsync Remote file copy (Synchronize file trees)
screen Terminal window manager
scp Secure copy (remote file copy)
sdiff Merge two files interactively
sed Stream Editor
select Accept keyboard input
seq Print numeric sequences
set Manipulate shell variables and functions
sftp Secure File Transfer Program
shift Shift positional parameters
shopt Shell Options
shutdown Shutdown or restart linux
sleep Delay for a specified time
sort Sort text files
source Run commands from a file `.’
split Split a file into fixed-size pieces
ssh Secure Shell client (remote login program)
strace Trace system calls and signals
su Substitute user identity
sum Print a checksum for a file
symlink Make a new name for a file
sync Synchronize data on disk with memory
tail Output the last part of files
tar Tape ARchiver
tee Redirect output to multiple files
test Evaluate a conditional expression
time Measure Program running time
times User and system times
touch Change file timestamps
top List processes running on the system
traceroute Trace Route to Host
trap Run a command when a signal is set(bourne)
tr Translate, squeeze, and/or delete characters
true Do nothing, successfully
tsort Topological sort
tty Print filename of terminal on stdin
type Describe a command
ulimit Limit user resources
umask Users file creation mask
umount Unmount a device
unalias Remove an alias
uname Print system information
unexpand Convert spaces to tabs
uniq Uniquify files
units Convert units from one scale to another
unset Remove variable or function names
unshar Unpack shell archive scripts
until Execute commands (until error)
useradd Create new user account
usermod Modify user account
users List users currently logged in
uuencode Encode a binary file
uudecode Decode a file created by uuencode
v Verbosely list directory contents (`ls -l -b’)
vdir Verbosely list directory contents (`ls -l -b’)
vi Text Editor
watch Execute/display a program periodically
wc Print byte, word, and line counts
whereis Report all known instances of a command
which Locate a program file in the user’s path.
while Execute commands
who Print all usernames currently logged in
whoami Print the current user id and name (`id -un’)
Wget Retrieve web pages or files via HTTP, HTTPS or FTP
xargs Execute utility, passing constructed argument list(s)
yes Print a string until interrupted
.period Run commands from a file
### Comment / Remark
Comandos DOS windows (NT-XP-2003)
ADDUSERS Add or list users to/from a CSV file
ARP Address Resolution Protocol
ASSOC Change file extension associations
ASSOCIAT One step file association
AT Schedule a command to run at a later time
ATTRIB Change file attributes
BOOTCFG Edit Windows boot settings
BROWSTAT Get domain, browser and PDC info
CACLS Change file permissions
CALL Call one batch program from another
CD Change Directory – move to a specific Folder
CHANGE Change Terminal Server Session properties
CHKDSK Check Disk – check and repair disk problems
CHKNTFS Check the NTFS file system
CHOICE Accept keyboard input to a batch file
CIPHER Encrypt or Decrypt files/folders
CleanMgr Automated cleanup of Temp files, recycle bin
CLEARMEM Clear memory leaks
CLIP Copy STDIN to the Windows clipboard.
CLS Clear the screen
CLUSTER Windows Clustering
CMD Start a new CMD shell
COLOR Change colors of the CMD window
COMP Compare the contents of two files or sets of files
COMPACT Compress files or folders on an NTFS partition
COMPRESS Compress individual files on an NTFS partition
CON2PRT Connect or disconnect a Printer
CONVERT Convert a FAT drive to NTFS.
COPY Copy one or more files to another location
CSVDE Import or Export Active Directory data
DATE Display or set the date
Dcomcnfg DCOM Configuration Utility
DEFRAG Defragment hard drive
DEL Delete one or more files
DELPROF Delete NT user profiles
DELTREE Delete a folder and all subfolders
DevCon Device Manager Command Line Utility
DIR Display a list of files and folders
DIRUSE Display disk usage
DISKCOMP Compare the contents of two floppy disks
DISKCOPY Copy the contents of one floppy disk to another
DNSSTAT DNS Statistics
DOSKEY Edit command line, recall commands, and create macros
DSADD Add user (computer, group..) to active directory
DSQUERY List items in active directory
DSMOD Modify user (computer, group..) in active directory
ECHO Display message on screen
ENDLOCAL End localisation of environment changes in a batch file
ERASE Delete one or more files
EXIT Quit the CMD shell
EXPAND Uncompress files
EXTRACT Uncompress CAB files
FC Compare two files
FDISK Disk Format and partition
FIND Search for a text string in a file
FINDSTR Search for strings in files
FOR /F Loop command: against a set of files
FOR /F Loop command: against the results of another command
FOR Loop command: all options Files, Directory, List
FORFILES Batch process multiple files
FORMAT Format a disk
FREEDISK Check free disk space (in bytes)
FSUTIL File and Volume utilities
FTP File Transfer Protocol
FTYPE Display or modify file types used in file extension associations
GLOBAL Display membership of global groups
GOTO Direct a batch program to jump to a labelled line
HELP Online Help
HFNETCHK Network Security Hotfix Checker
IF Conditionally perform a command
IFMEMBER Is the current user in an NT Workgroup
IPCONFIG Configure IP
KILL Remove a program from memory
LABEL Edit a disk label
LOCAL Display membership of local groups
LOGEVENT Write text to the NT event viewer.
LOGOFF Log a user off
LOGTIME Log the date and time in a file
MAPISEND Send email from the command line
MEM Display memory usage
MD Create new folders
MODE Configure a system device
MORE Display output, one screen at a time
MOUNTVOL Manage a volume mount point
MOVE Move files from one folder to another
MOVEUSER Move a user from one domain to another
MSG Send a message
MSIEXEC Microsoft Windows Installer
MSINFO Windows NT diagnostics
MSTSC Terminal Server Connection (Remote Desktop Protocol)
MUNGE Find and Replace text within file(s)
MV Copy in-use files
NET Manage network resources
NETDOM Domain Manager
NETSH Configure network protocols
NETSVC Command-line Service Controller
NBTSTAT Display networking statistics (NetBIOS over TCP/IP)
NETSTAT Display networking statistics (TCP/IP)
NOW Display the current Date and Time
NSLOOKUP Name server lookup
NTBACKUP Backup folders to tape
NTRIGHTS Edit user account rights
PATH Display or set a search path for executable files
PATHPING Trace route plus network latency and packet loss
PAUSE Suspend processing of a batch file and display a message
PERMS Show permissions for a user
PERFMON Performance Monitor
PING Test a network connection
POPD Restore the previous value of the current directory saved by PUSHD
PORTQRY Display the status of ports and services
PRINT Print a text file
PRNCNFG Display, configure or rename a printer
PRNMNGR Add, delete, list printers set the default printer
PROMPT Change the command prompt
PsExec Execute process remotely
PsFile Show files opened remotely
PsGetSid Display the SID of a computer or a user
PsInfo List information about a system
PsKill Kill processes by name or process ID
PsList List detailed information about processes
PsLoggedOn Who’s logged on (locally or via resource sharing)
PsLogList Event log records
PsPasswd Change account password
PsService View and control services
PsShutdown Shutdown or reboot a computer
PsSuspend Suspend processes
PUSHD Save and then change the current directory
QGREP Search file(s) for lines that match a given pattern.
RASDIAL Manage RAS connections
RASPHONE Manage RAS connections
RECOVER Recover a damaged file from a defective disk.
REG Read, Set or Delete registry keys and values
REGEDIT Import or export registry settings
REGSVR32 Register or unregister a DLL
REGINI Change Registry Permissions
REM Record comments (remarks) in a batch file
REN Rename a file or files.
REPLACE Replace or update one file with another
RD Delete folder(s)
RDISK Create a Recovery Disk
RMTSHARE Share a folder or a printer
ROBOCOPY Robust File and Folder Copy
ROUTE Manipulate network routing tables
RUNAS Execute a program under a different user account
RUNDLL32 Run a DLL command (add/remove print connections)
SC Service Control
SCHTASKS Create or Edit Scheduled Tasks
SCLIST Display NT Services
ScriptIt Control GUI applications
SET Display, set, or remove environment variables
SETLOCAL Control the visibility of environment variables
SETX Set environment variables permanently
SHARE List or edit a file share or print share
SHIFT Shift the position of replaceable parameters in a batch file
SHORTCUT Create a windows shortcut (.LNK file)
SHOWGRPS List the NT Workgroups a user has joined
SHOWMBRS List the Users who are members of a Workgroup
SHUTDOWN Shutdown the computer
SLEEP Wait for x seconds
SOON Schedule a command to run in the near future
SORT Sort input
START Start a separate window to run a specified program or command
SU Switch User
SUBINACL Edit file and folder Permissions, Ownership and Domain
SUBST Associate a path with a drive letter
SYSTEMINFO List system configuration
TASKLIST List running applications and services
TIME Display or set the system time
TIMEOUT Delay processing of a batch file
TITLE Set the window title for a CMD.EXE session
TOUCH Change file timestamps
TRACERT Trace route to a remote host
TREE Graphical display of folder structure
TYPE Display the contents of a text file
USRSTAT List domain usernames and last login
VER Display version information
VERIFY Verify that files have been saved
VOL Display a disk label
WHERE Locate and display files in a directory tree
WHOAMI Output the current UserName and domain
WINDIFF Compare the contents of two files or sets of files
WINMSD Windows system diagnostics
WINMSDP Windows system diagnostics II
WMIC WMI Commands
XCACLS Change file permissions
XCOPY Copy files and folders
———————————-
Comando |
Descripción |
|
| • |
apropos palabra |
Ver comandos relacionados con palabra. Ver también threadsafe |
which comando |
Ver la ruta completa de comando | |
time comando |
Medir cuanto tarda comando | |
| • |
time cat |
Iniciar cronómetro. Ctrl-d para detenerlo. Ver también sw |
| • |
nice info |
Lanzar comando con prioridad baja (info en este ejemplo) |
| • |
renice 19 -p $$ |
Darle prioridad baja al shell (guión). Usar para tareas no interactivas |
dir navegación |
||
| • |
cd - |
Volver al directorio anterior |
| • |
cd |
Ir al directorio personal (home) |
(cd dir && comando) |
Ir a dir, ejecutar comando y volver al directorio inicial | |
| • |
pushd . |
Guardar el directorio actual en la pila para luego, poder hacer popd y volver al mismo |
búsquedas de archivo |
||
| • |
alias l='ls -l --color=auto' |
listado de directorio rápido |
| • | ls -lrt | Listar archivos por fecha. Ver también newest |
| • | ls /usr/bin | pr -T9 -W$COLUMNS | Imprimir 9 columnas en ancho de la terminal |
| find -name ‘*.[ch]‘ | xargs grep -E ‘expre’ | Buscar ‘expre’ en este directorio y subdirectorios. Ver también findrepo | |
| find -type f -print0 | xargs -r0 grep -F ‘ejemplo’ | Buscar ‘ejemplo’ en todos los archivos regulares en este directorio y subdirectorios | |
| find -maxdepth 1 -type f | xargs grep -F ‘ejemplo’ | Buscar ‘ejemplo’ en todos los archivos regulares de este directorio | |
| find -maxdepth 1 -type d | while read dir; do echo $dir; echo cmd2; done | Procesar cada elemento con muchos comandos (con un bucle while) | |
| • | find -type f ! -perm -444 | Hallar archivos sin permiso general de lectura (util para sedes web) |
| • | find -type d ! -perm -111 | Hallar directorios sin permiso general de acceso (util para sedes web) |
| • | locate -r ‘file[^/]*\.txt’ | Buscar nombres en indice en cache. Este re es igual a glob *file*.txt |
| • | look referencia | Búsqueda rápida (ordenada) de prefijo en diccionario |
| • | grep –color referencia /usr/share/dict/palabras | Resaltar ocurrencias de expresión regular en diccionario |
Archivos |
||
| gpg -c file | Encriptar archivo | |
| gpg file.gpg | Desencriptar archivo | |
| tar -c dir/ | bzip2 > dir.tar.bz2 | Crear archivo compacto de dir/ | |
| bzip2 -dc dir.tar.bz2 | tar -x | Extraer archivo compacto (usar gzip en vez de bzip2 para archivos tar.gz ) | |
| tar -c dir/ | gzip | gpg -c | ssh user@remoto ‘dd of=dir.tar.gz.gpg’ | Crear compactado encriptado de dir/ en equipo remoto | |
| find dir/ -name ‘*.txt’ | tar -c –files-from=- | bzip2 > dir_txt.tar.bz2 | Crear compactado de subconjunto de dir/ y subdirectorios | |
| find dir/ -name ‘*.txt’ | xargs cp -a –target-directory=dir_txt/ –parents | Copiar subconjunto de dir/ y subdirectorios | |
| ( tar -c /dire/de/copiame ) | ( cd /este/dir/ && tar -x -p ) | Copiar (con permisos) directorio copiame/ a directorio /este/dir/ | |
| ( cd /dire/de/copiame && tar -c . ) | ( cd /este/dir/ && tar -x -p ) | Copiar (con permisos) contenido del directorio copiame/ a directorio /este/dir/ | |
| ( tar -c /dire/de/copiame ) | ssh -C user@remoto ‘cd /este/dir/ && tar -x -p’ | Copiar (con permisos) directorio copiame/ a directorio remoto /este/dir/ | |
| dd bs=1M if=/dev/hda | gzip | ssh user@remoto ‘dd of=hda.gz’ | Respaldo de disco duro en equipo remoto | |
rsync (Usar la opción –dry-run para probarlo) |
||
| rsync -P rsync://rsync.servidor.com/ruta/a/archivo archivo | Obtenerr solo diffs. Repetir muchas veces para descargas conflictivas | |
| rsync –bwlimit=1000 desdearchivo alarchivo | Copia local con taza límite. Parecido a nice para E/S (I/O) | |
| rsync -az -e ssh –delete ~/public_html/ remoto.com:’~/public_html’ | Espejo de sede web (usando compresión y encriptado) | |
| rsync -auz -e ssh remote:/dir/ . && rsync -auz -e ssh . remote:/dir/ | Sincronizando directorio actual con uno remoto | |
wget (herramienta de descargas multiuso) |
||
| • | (cd cmdline && wget -nd -pHEKk http://www.pixelbeat.org/cmdline.html) | Guardar en directorio actual una versión navegable de una página web |
| wget -c http://www.ejemplo.com/largo.archivo | Retomar descarga de un archivo parcialmente descargado | |
| wget -r -nd -np -l1 -A ‘*.jpg’ http://www.ejemplo.com/ | Descargar una serie de archivos en el directorio actual | |
| wget ftp://remoto/archivo[1-9].iso/ | FTP permite globalizaciones directas | |
| • | wget -q -O- http://www.pixelbeat.org/timeline.html | grep ‘a href’ | head | Procesando directamente la salida |
| echo ‘wget url’ | at 01:00 | Descargar la url a 1AM al directorio en que esté | |
| wget –limit-rate=20k url | Hacer descargas de baja prioridad (en este caso, no exceder los 20KB/s) | |
| wget -nv –spider –force-html -i bookmarks.html | Revisando los enlaces de una página | |
| wget –mirror http://www.ejemplo.com/ | Actualizar eficientemente una copia local de una página web (útil si usamos cron) | |
Redes (Nota los comandos ifconfig, route, mii-tool, nslookup son obsoletos) |
||
| ethtool interface | Listar estado de interfase | |
| • | ip link show | Listar interfases |
| ip link set dev eth0 name wan | Renombrar eth0 a wan | |
| ip addr add 1.2.3.4/24 brd + dev eth0 | Agregar ip y máscara (255.255.255.0) | |
| ip link set dev interface up | Subir (o bajar) la interfase | |
| ip route add default via 1.2.3.254 | Establecer 1.2.3.254 como valor por omisión para la puerta de enlace. | |
| • | tc qdisc add dev lo root handle 1:0 netem delay 20msec | Agregarle 20ms de espera al dispositivo de retorno (para hacer pruebas) |
| • | tc qdisc del dev lo root | Quitar la espera agregada antes. |
| • | host pixelbeat.org | Obtener la dirección ip para el dominio o al revés |
| • | hostname -i | Obtener la dirección ip local (equivale al anfitrión `hostname`) |
| • | netstat -tupl | Listar los servicios de internet de un sistema |
| • | netstat -tup | Listar las conexiones activas de/hacia un sistema |
Windows (nota samba es el paquete que permite todos estos comandos de redes de windows ) |
||
| • | smbtree | Hallar equipos windows. Ver también findsmb |
| nmblookup -A 1.2.3.4 | Hallar el nombre (netbios) de windows asociado con la dirección ip | |
| smbclient -L windows_box | Listar archivos compartidos en equipos windows o servidor samba | |
| mount -t smbfs -o fmask=666,guest //windows_box/share /mnt/share | Montar un directorio compartido | |
| echo ‘mensaje’ | smbclient -M windows_box | Enviar mensaje emergente al equipo windows (desactivado por omisión en XP sp2) | |
Matemáticas |
||
| • | echo ‘(1 + sqrt(5))/2′ | bc -l | Cuentas rápidas (Calcular φ). Ver también bc |
| • | echo ‘obase=16; ibase=10; 64206′ | bc | Conversiones de base (decimal a hexadecimal) |
| • | echo $((0x2dec)) | Conversiones de base (hex a dec) ((expansión aritmética del shell)) |
| • | echo ‘pad=20; min=64; (100*10^6)/((pad+min)*8)’ | bc | Mas complejo (int) x.ej. Ejemplo: tasa máxima de paquetes FastE |
| • | echo ‘pad=20; min=64; print (100E6)/((pad+min)*8)’ | python | Python maneja notación científica |
| • | echo ‘pad=20; plot [64:1518] (100*10**6)/((pad+x)*8)’ | gnuplot -persist | Graficar tasa de paquetes FastE vs. tamaño de paquetes |
| • | seq 100 | (tr ‘\n’ +; echo 0) | bc | Agregar una columna de números. Ver también add y funcpy |
Manejo de textos (nota: como sed usa stdin y stdout, para editar archivos, agregar… <viejoarchivo >nuevoarchivo) |
||
| sed ‘s/cadena1/cadena2/g’ | Remplaza cadena1 por cadena2 | |
| sed ‘s/\(.*\)1/\12/g’ | Modificar cualquiercadena1 con cualquiercadena2 | |
| sed ‘/ *#/d; /^ *$/d’ | Quitar comentarios y lineas en blanco | |
| sed ‘:a; /\\$/N; s/\\\n//; ta’ | Concatenar lineas con \ al final | |
| sed ‘s/[ \t]*$//’ | Quitar blancos finales de las lineas | |
| sed ‘s/\([\\`\\"$\\\\]\)/\\\1/g’ | Escapar metacaracteres activos del shell dentro de comillas dobles | |
| sed -n ’1000p;1000q‘ | Listar la línea 1000° | |
| sed -n ’10,20p;20q‘ | Listar de la linea 10 a la 20 | |
| sed -n ‘s/.*<title>\(.*\)<\/title>.*/\1/ip;T;q‘ | Extraer titulo de página web en HTML | |
| sort -t. -k1,1n -k2,2n -k3,3n -k4,4n | Sort de direcciones ip de tipo IPV4 | |
| • | echo ‘Test’ | tr ‘[:lower:]‘ ‘[:upper:]‘ | Conversión de cajas |
| • | tr -dc ‘[:print:]‘ < /dev/urandom | Filtrando caracteres no imprimibles |
| • | grep ‘processor’ /proc/cpuinfo | wc -l | Contar lineas |
Definir operaciones (Nota export LANG=C es para acelerar, aquí también se supone que no hay líneas duplicadas en los archivos) |
||
| sort archivo1 archivo2 | uniq | Union de archivos sin ordenar | |
| sort archivo1 archivo2 | uniq -d | Intersección de archivos sin ordenar | |
| sort archivo1 archivo1 archivo2 | uniq -u | Diferencia de archivos sin ordenar | |
| sort archivo1 archivo2 | uniq -u | Diferencia Simétrica de archivos sin ordenar | |
| comm archivo1 archivo2 | sed ‘s/^\t*//’ | Unión de archivos ordenados | |
| comm -12 archivo1 archivo2 | Intersección de archivos ordenados | |
| comm -13 archivo1 archivo2 | Diferencia de archivos ordenados | |
| comm -3 archivo1 archivo2 | sed ‘s/^\t*//’ | Diferencia Simétrica de archivos ordenados | |
Calendario |
||
| • | cal -3 | Mostrar calendario |
| • | cal 9 1752 | Mostrar calendario para mes y año determinado |
| • | date -d fri | Que día cae este viernes. Ver también day |
| • | date –date=’25 Dec’ +%A | ¿En que día cae la Navidad, este año? |
| • | date –date ’1970-01-01 UTC 1234567890 seconds’ | Convertir total de segundos desde la época a una fecha |
| • | TZ=’:America/Los_Angeles’ date | ¿Que hora es en la Costa Oeste de EEUU (usar tzselect para hallar TZ) |
| echo “mail -s ‘tomar el tren’ P@draigBrady.com < /dev/null” | at 17:45 | Recordatorio por email | |
| • | echo “DISPLAY=$DISPLAY xmessage cooker” | at “NOW + 30 minutes” | Recordatorio emergente |
Locales |
||
| • | printf “%’d\n” 1234 | Imprimir numero agrupado por miles de acuerdo a su locale |
| • | BLOCK_SIZE=\’1 ls -l | pedir que ls agrupe por miles de acuerdo a su locale |
| • | echo “Yo vivo en `locale territory`” | Extraer información de la base de datos del locale |
| • | LANG=en_IE.utf8 locale int_prefix | Buscar información de locale para determinado país. Ver también ccodes |
| • | locale | cut -d= -f1 | xargs locale -kc | less | Listar campos en base de datos del locale |
Conversiones caracteres – Codificación – Encodificación Recode (obsoletos: iconv, dos2unix, unix2dos) |
||
| • | recode -l | less | Ver conversiones disponibles (aliases en cada línea) |
| recode windows-1252.. archivo_a_cambiar.txt | “ansi” de Windows a tabla de caracteres locales (auto hace conversión CRLF) | |
| recode utf-8/CRLF.. archivo_a_cambiar.txt | utf8 de Windows a tabla de caracteres locales | |
| recode iso-8859-15..utf8 archivo_a_cambiar.txt | Latin9 (Europa oriental) a utf8 | |
| recode ../b64 < archivo.txt > archivo.b64 | Codificado Base64 | |
| recode /qp.. < archivo.txt > archivo.qp | Decodificado de citas imprimibles (qp) | |
| recode ..HTML < archivo.txt > archivo.html | Texto a HTML | |
| • | recode -lf windows-1252 | grep euro | Buscar tabla de caracteres |
| • | echo -n 0×80 | recode latin-9/x1..dump | Mostrar representación de un código en tabla de caracteres latin-9 |
| • | echo -n 0x20AC | recode ucs-2/x2..latin-9/x | Ver codificado latin-9 |
| • | echo -n 0x20AC | recode ucs-2/x2..utf-8/x | Ver codificado utf-8 |
CDs |
||
| gzip < /dev/cdrom > cdrom.iso.gz | Guardar una copia de los datos de cdrom | |
| mkisofs -V NOMBRE -r dir | gzip > cdrom.iso.gz | Crear imagen de cdrom con el contenido de dir | |
| mount -o loop cdrom.iso /mnt/dir | Montar la imagen cdrom en /mnt/dir (solo lectura) | |
| cdrecord -v dev=/dev/cdrom blank=fast | Limpiar un CDRW | |
| gzip -dc cdrom.iso.gz | cdrecord -v dev=/dev/cdrom - | Grabar un cdrom con imagen (usar dev=ATAPI -scanbus para confirmar ruta dev) | |
| cdparanoia -B | Extraer pistas de audio desde un CD a archivos wav en directorio actual | |
| cdrecord -v dev=/dev/cdrom -audio *.wav | Armar un CD de audio con todos los wavs en directorio actual (ver también cdrdao) | |
| oggenc –tracknum=’pista’ pista.cdda.wav -o ‘pista.ogg’ | Crear un archivo ogg con un archivo wav | |
Espacio de disco (Ver también FSlint) |
||
| • | ls -lSr | Mostrar archivos, de menor a mayor |
| • | du -s * | sort -k1,1rn | head | Mostrar usuarios de disco principales en el directorio actual. Ver también dutop |
| • | df -h | Mostrar espacio libre de disco |
| • | df -i | Mostrar inodos libres |
| • | fdisk -l | Mostrar tamaños y tipos de particiones de disco (pedir como root) |
| • | rpm -q -a –qf ‘%10{SIZE}\t%{NAME}\n’ | sort -k1,1n | Listar todos los paquetes por tamaño instalado (Bytes) de distribuciones RPMs |
| • | dpkg-query -W -f=’${Installed-Size;10}\t${Package}\n’ | sort -k1,1n | istar todos los paquetes por tamaño instalado (Kbytes) de distribuciones deb |
| • | dd bs=1 seek=2TB if=/dev/null of=ext3.test | Crear un gran archivo de prueba (sin ocupar espacio). Ver también truncate |
Monitoreo/rastreo |
||
| • | strace -c ls >/dev/null | Resumir/perfil de llamadas al sistema hechas con comando |
| • | strace -f -e open ls >/dev/null | Listar llamadas al sistema hechas con comando |
| • | ltrace -f -e getenv ls >/dev/null | Listar llamadas a librerías hechas con comando |
| • | lsof -p $$ | Listar las rutas que abrió el id de proceso |
| • | lsof ~ | Listar procesos que solicitaron apertura de rutas |
| • | tcpdump not port 22 | Ver tráfico de redes excepto ssh. Ver también tcpdump_not_me |
| • | ps -e -o pid,args –forest | Listar procesos de una jerarquía |
| • | ps -e -o pcpu,cpu,nice,state,cputime,args –sort pcpu | sed ‘/^ 0.0 /d’ | Listar procesos por % de uso de cpu |
| • | ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS | Listar procesos por uso de memoria. Ver también ps_mem.py |
| • | ps -C firefox-bin -L -o pid,tid,pcpu,state | Listar todos los hilos de un proceso determinado |
| • | ps -p 1,2 | Listar información de un ID determinado |
| • | last reboot | Ver historia de reencendido del sistema |
| • | free -m | Ver cantidad de RAM (que queda) (-m muestra en MB) |
| • | watch -n.1 ‘cat /proc/interrupts’ | Observar continuamente los datos que van cambiando |
Información del sistema (Ver también sysinfo) |
||
| hdparm -i /dev/hda | Ver informe sobre partición hda | |
| hdparm -tT /dev/hda | Hacer una prueba de velocidad de lectura en partición hda | |
| badblocks -s /dev/hda | Hallar bloques ilegibles en partición hda | |
| • | mount | column -t | Ver particiones montadas en el sistema (y alinear la salida) |
| • | cat /proc/partitions | Ver todas las particiones registradas en el sistema |
| • | grep MemTotal /proc/meminfo | Ver el total de RAM que registra el sistema |
| • | grep “model name” /proc/cpuinfo | Ver informe de CPU(s) |
| • | lspci -tv | Ver informe de PCI |
| • | lsusb -tv | Ver informe de USB |
Interactivo |
||
| • | mc | Poderoso administrador de archivos que permite navegar por rpm, tar, ftp, ssh, … |
| • | screen | Terminales virtuales con capacidad de reacomodamiento, … |
| • | links | Navegador web |
| • | gnuplot | Graficos interactivos/ programables |
| • | octave | Entorno parecido a Matlab |
Varios |
||
| • | alias hd=’od -Ax -tx1z -v’ | Práctico vuelco hexa. (uso x.ej.: • hd /proc/self/cmdline | less) |
| • | alias realpath=’readlink -f’ | Canonicalizar ruta. (uso x.ej.: • realpath ~/../$USER) |
| • | set | grep $USER | Buscar en el entorno actual |
| touch -c -t 0304050607 archivo | Asignarle a archivo la fecha (AAMMDDhhmm) | |
| • | python -m SimpleHTTPServer | Serve current directory tree at http://$HOSTNAME:8000/ |
———————————————–
lspci Muestra todos los dispositivos del sistema
lspci -v Muestra todos los dispositivos del sistema en detalle
lsusb Puertos usb
lshw Listado del Hardware
2 Comments »
RSS feed for comments on this post. TrackBack URL

El listado sería perfecto si la descripción de los comandos son traducidos a español. Si quieres me mandas un e-mail y lo traducimos juntos.
This is a excellent piece of content, I found your blog searching bing for a similar theme and arrived to this. I couldnt find to much additional info on this piece of content, so it was pleasant to locate this one. I will be returning to look at some other posts that you have another time.