Tel 678.697.4783
Fax 678.840.7870
Po Box 4432
Marietta, Ga 30061
info@jamboconsulting.com

 Subscribe in a reader



Lunarpages.com Web Hosting
Web hosting by ICDSoft

Archives

Previous Posts

Powered by Blogger

Saturday, June 27, 2009

Changind Directory Colors in Terminal

The default directory colors blue can be vary hard to read with a dark terminal background. Under Linux changing this color typically involves setting the LS_COLORS environment variable.

Sample ~/.bashrc file:

alias ls='ls --color'
LS_COLORS='di=1:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.rpm=90'
export LS_COLORS


Bartman has the following information on the various options:

di = directory
fi = file
ln = symbolic link
pi = fifo file
so = socket file
bd = block (buffered) special file
cd = character (unbuffered) special file
or = symbolic link pointing to a non-existent file (orphan)
mi = non-existent file pointed to by a symbolic link (visible when you type ls -l)
ex = file which is executable (ie. has 'x' set in permissions).

0 = default colour
1 = bold
4 = underlined
5 = flashing text
7 = reverse field
31 = red
32 = green
33 = orange
34 = blue
35 = purple
36 = cyan
37 = grey
40 = black background
41 = red background
42 = green background
43 = orange background
44 = blue background
45 = purple background
46 = cyan background
47 = grey background
90 = dark grey
91 = light red
92 = light green
93 = yellow
94 = light blue
95 = light purple
96 = turquoise
100 = dark grey background
101 = light red background
102 = light green background
103 = yellow background
104 = light blue background
105 = light purple background
106 = turquoise background


However, under OS X Leopard the method is different. The directories colors are set through the LSCOLORS environment variable instead. They options for LSCOLORS are listed in the ls man page:

LSCOLORS The value of this variable describes what color to use for
which attribute when colors are enabled with CLICOLOR. This
string is a concatenation of pairs of the format fb, where f
is the foreground color and b is the background color.

The color designators are as follows:

a black
b red
c green
d brown
e blue
f magenta
g cyan
h light grey
A bold black, usually shows up as dark grey
B bold red
C bold green
D bold brown, usually shows up as yellow
E bold blue
F bold magenta
G bold cyan
H bold light grey; looks like bright white
x default foreground or background

Note that the above are standard ANSI colors. The actual
display may differ depending on the color capabilities of
the terminal in use.

The order of the attributes are as follows:

1. directory
2. symbolic link
3. socket
4. pipe
5. executable
6. block special
7. character special
8. executable with setuid bit set
9. executable with setgid bit set
10. directory writable to others, with sticky bit
11. directory writable to others, without sticky bit

The default is "exfxcxdxbxegedabagacad", i.e. blue fore-
ground and default background for regular directories, black
foreground and red background for setuid executables, etc.


I use the following in my ~/.profile :

export LSCOLORS='gxfxcxdxbxegedabagacad'




COLORS Lscolors - Linux StepByStep

Article Link posted by Edward at 3:15 PM

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home