Primero, con respecto a los colores en general, este script puede interesarle. Funciona bien en la consola (en una terminal, el ancho de la pestaña no se configura correctamente).
#!/bin/bash
setterm -regtabs 4
Color_names="bla red gre yel blu mag cya whi"
Color_arr=($Color_names)
tput setaf 4
tput setab 7
echo -n " normal "
tput sgr0
echo -n " "
tput setaf 7
tput setab 4
echo " bright "
tput sgr0
for cmd in sgr0 bold
do
tput $cmd
for m in 0 1 2 3 4 5 6 7
do
tput setaf $m
echo -n ${Color_arr[$m]}" "
done
done
echo
tput sgr0
cat /sys/module/vt/parameters/default_red \
/sys/module/vt/parameters/default_grn \
/sys/module/vt/parameters/default_blu | sed s/,0/", "/g | \
sed s/^0/" "/g | \
tr "," "\t"
En segundo lugar, puedes hacer mucho más con ls que solo --color=auto. Pero, requiere un poco de trabajo para resolver todo. Escribí un script para facilitar la comprensión, así como para colorear los archivos (en función de sus extensiones) de manera sistemática.
Si es demasiado largo para pegarlo, échale un vistazo aquí .
#!/bin/bash
# must be sourced
# see `man dircolors`
# in particular `dircolors -p > coldb.txt` (-p, --print-database)
# attributes
# 00 = none
# 01 = bold (bright)
# 04 = underscore (white; disables color code)
# 05 = blink (gray background)
# 07 = reverse (color as background)
# 08 = concealed (doesn't do anything)
# colors
R='00;31' # red
G='00;32' # green
Y='00;33' # yellow (brown in my console)
B='00;34' # blue
M='00;35' # magenta
C='00;36' # cyan
W='00;37' # white
# bold (bright)
BR='01;31' # red
BG='01;32' # green
BY='01;33' # yellow
BB='01;34' # blue
BM='01;35' # magenta
BC='01;36' # cyan
BW='01;37' # white
# for di (below) and possible some others
BL='00;30' # black
GR='01;30' # gray
# background
BGBL='40' # blue
BGRE='41' # red
BGGR='42' # green
BGYE='43' # yellow
BGBL='44' # blue
BGMA='45' # magenta
BGCY='46' # cyan
BGWH='47' # white
RS="rs=0" # reset
DI="di=$BB" # directory
LN="ln=$C" # link
MH="mh=00" # multihardlink (file with more than one link)
PI="pi=$BY;$BGBL" # pipe (FIFO)
SO="so=$BM" # socket
DO="do=$BM" # door
BD="bd=$BY;$GBBL" # block device driver
CD="cd=$BY;$BGBL" # character device driver
OR="or=$BR" # symlink to nonexistent (or non-stat'able) file
SU="su=$W;$BGRE" # file that is setuid (u+s)
SG="sg=$BL;$BGYE" # file that is setgid (g+s)
CA="ca=$BL;$BGRE" # file with capability
TW="tw=$BL;$BGGR" # dir that is sticky and other-writable (+t,o+w)
OW="ow=$BB;$BGGR" # dir that is other-writable (o+w) and not sticky
ST="st=$BW;$BGBL" # sticky bit dir (+t) and not other-writable
EX="ex=$BG" # file with execute permission
ARCHIVE="*.tar=$BR:*.tgz=$BR:*.arj=$BR:*.taz=$BR:*.lzh=$BR:*.lzma=$BR:*.tlz=$BR:*.txz=$BR:*.zip=$BR:*.z=$BR:*.Z=$BR:*.dz=$BR:*.gz=$BR:*.lz=$BR:*.xz=$BR:*.bz2=$BR:*.bz=$BR:*.tbz=$BR:*.tbz2=$BR:*.tz=$BR:*.deb=$BR:*.rpm=$BR:*.jar=$BR:*.war=$BR:*.ear=$BR:*.sar=$BR:*.rar=$BR:*.ace=$BR:*.zoo=$BR:*.cpio=$BR:*.7z=$BR:*.rz=$BR"
IMAGE="*.jpg=$BM:*.jpeg=$BM:*.gif=$BM:*.bmp=$BM:*.pbm=$BM:*.pgm=$BM:*.ppm=$BM:*.tga=$BM:*.xbm=$BM:*.xpm=$BM:*.tif=$BM:*.tiff=$BM:*.png=$BM:*.svg=$BM:*.svgz=$BM:*.mng=$BM:*.pcx=$BM"
MOVIE="*.mov=$M:*.mpg=$M:*.mpeg=$M:*.m2v=$M:*.mkv=$M:*.webm=$M:*.ogm=$M:*.mp4=$M:*.m4v=$M:*.mp4v=$M:*.vob=$M:*.qt=$M:*.nuv=$M:*.wmv=$M:*.asf=$M:*.rm=$M:*.rmvb=$M:*.flc=$M:*.avi=$M:*.fli=$M:*.flv=$M:*.gl=$M:*.dl=$M:*.xcf=$M:*.xwd=$M:*.yuv=$M:*.cgm=$M:*.emf=$M:*.axv=$M:*.anx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