informatica:sistemas_operativos:linux:coreutils:ls
¡Esta es una revisión vieja del documento!
ls
Programa que permite listar ficheros y directorios
Ejemplo:
$ ls -l /etc/ total 1384 -rw-r--r--. 1 root root 16 mar 10 2016 adjtime -rw-r--r--. 1 root root 1518 jun 7 2013 aliases -rw-r--r--. 1 root root 12288 feb 23 2017 aliases.db drwxr-xr-x. 2 root root 4096 oct 9 2018 alternatives -rw-------. 1 root root 541 abr 21 2015 anacrontab -rw-r--r--. 1 root root 55 sep 16 2014 asound.conf -rw-r--r--. 1 root root 5 mar 10 2016 at.allow drwxr-x---. 3 root root 41 feb 20 2017 audisp drwxr-x---. 3 root root 102 feb 20 2017 audit drwxr-xr-x. 2 root root 33 mar 10 2016 avahi -rw-r--r--. 1 root root 2863 mar 10 2016 bash.20150601 drwxr-xr-x. 2 root root 4096 feb 20 2017 bash_completion.d -rw-r--r--. 1 root root 2863 mar 10 2016 bashrc -rw-r--r--. 1 root root 2835 mar 10 2016 bashrc.20160310
Colores
ls toma los colores que estén definidos en la variable de entorno LS_COLORS
Podemos incluir la personalización de esta variable de entorno en el fichero .bashrc de nuestro directorio personal:
export LS_COLORS="$LS_COLORS:st=38;5;86;48;5;234:ow=38;5;220;1:tw=48;5;235;38;5;139;3:di=38;5;30:bd=38;5;68:cd=38;5;113;1:ex=38;5;208;1:fi=0:no=0:ln=38;5;45:"
Aplicamos los cambios saliendo de la sesión y entrando de nuevo o source $HOME/.bashrc
Posibilidades de efectos:
| Valor | Descripción |
|---|---|
| 0 | Color por defecto |
| 1 | Negrita |
| 4 | Subrayado |
| 5 | Parpadeo |
| 7 | Intercambia los colores de texto y de fondo |
| 8 | Invisible |
Posibilidades de fondos:
| Valor | Descripción |
|---|---|
| 40 | Negro |
| 41 | Rojo |
| 42 | Verde |
| 43 | Naranja |
| 44 | Azul |
| 45 | Morado |
| 46 | Cián |
| 47 | Gris |
| 100 | Gris oscuro |
| 101 | Rojo claro |
| 102 | Verde claro |
| 103 | Amarillo |
| 104 | Azul claro |
| 105 | Morado claro |
| 106 | Turquesa |
| 107 | Blanco |
Tipos de ficheros:
| Valor | Descripción |
|---|---|
| bd | = (BLOCK, BLK) Block device (buffered) special file |
| cd | = (CHAR, CHR) Character device (unbuffered) special file |
| di | = (DIR) Directory |
| do | = (DOOR) [Door][1] |
| ex | = (EXEC) Executable file (ie. has 'x' set in permissions) |
| fi | = (FILE) Normal file |
| ln | = (SYMLINK, LINK, LNK) Symbolic link. If you set this to ‘target’ instead of a numerical value, the color is as for the file pointed to. |
| mi | = (MISSING) Non-existent file pointed to by a symbolic link (visible when you type ls -l) |
| no | = (NORMAL, NORM) Normal (non-filename) text. Global default, although everything should be something |
| or | = (ORPHAN) Symbolic link pointing to an orphaned non-existent file |
| ow | = (OTHER_WRITABLE) Directory that is other-writable (o+w) and not sticky |
| pi | = (FIFO, PIPE) Named pipe (fifo file) |
| sg | = (SETGID) File that is setgid (g+s) |
| so | = (SOCK) Socket file |
| st | = (STICKY) Directory with the sticky bit set (+t) and not other-writable |
| su | = (SETUID) File that is setuid (u+s) |
| tw | = (STICKY_OTHER_WRITABLE) Directory that is sticky and other-writable (+t,o+w) |
| *.extension | = Every file using this extension e.g. *.rpm = files with the ending .rpm |
informatica/sistemas_operativos/linux/coreutils/ls.1629801311.txt.gz · Última modificación: por tempwin
