Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:ressources:astuces:lscolor [2011/04/11 14:14] (current)
Line 1: Line 1:
 +====== Change default LS colors on Debian ======
 +{{tag> debian}}
 +By default, the LS version of Debian uses a regular blue color for the directories. And, as many others, I'm completely unable to read this on a black background.
 +So, to change this, do the following for each user, or globally in **/​etc/​bash.bashrc**:​
  
 +===== Get the current dircolors =====
 +
 +<code bash>
 +# dircolors -p > ~/​.dircolorsrc
 +</​code>​
 +
 +This creates a dircolor file in /​root/​.dircolorsrc that you can edit with any text editor.
 +
 +===== Change the blue color =====
 +
 +With vim, open the file and find the line "​DIR"​ and change its color value from 34 (blue) to 33 (yellow).
 +
 +<​code>​
 +# vim /​root/​.dircolorsrc
 +
 +[...]
 +
 +53 # Below are the color init strings for the basic file types. A color init 
 + 54 # string consists of one or more of the following numeric codes: ​
 + 55 # Attribute codes: ​
 + 56 # 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed ​
 + 57 # Text color codes: ​
 + 58 # 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white ​
 + 59 # Background color codes: ​
 + 60 # 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white ​
 + 61 NORMAL 00 # global default, although everything should be something. ​
 + 62 FILE 00 # normal file 
 + 63 DIR 01;33 # directory ​
 + 64 LINK 01;36 # symbolic link. (If you set this to '​target'​ instead of a 
 + ​65 ​ # numerical value, the color is as for the file pointed to.) 
 + 66 FIFO 40;33 # pipe 
 + 67 SOCK 01;35 # socket ​
 + 68 DOOR 01;35 # door 
 + 69 BLK 40;33;01 # block device driver ​
 + 70 CHR 40;33;01 # character device driver ​
 + 71 ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'​able file 
 + 72 SETUID 37;41 # file that is setuid (u+s) 
 + 73 SETGID 30;43 # file that is setgid (g+s) 
 + 74 STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,​o+w) ​
 + 75 OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky ​
 + 76 STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable ​
 + 77 # This is for files with execute permission: ​
 + 78 EXEC 01;32
 +</​code>​
 +
 +
 +===== Load the colors when Bash starts =====
 +
 +In you local ~/.bashrc file, modify the line **eval "​`dircolors`"​** into **eval "​`dircolors -b ~/​.dircolorsrc`"​**.
 +
 +<​code>​
 +# vim /​root/​.bashrc
 +
 +[...]
 +
 +# You may uncomment the following lines if you want `ls' to be colorized:
 +eval "​`dircolors -b ~/​.dircolorsrc`"​
 +export LS_OPTIONS='​--color=auto'​
 +</​code>​
 +
 +That's it. Close your current session and open a new one to reload bash and the output of your LS commands will now show directories in yellow.
 +
 +~~DISCUSSION~~
en/ressources/astuces/lscolor.txt ยท Last modified: 2011/04/11 14:14 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0