Thursday, June 25, 2009

Changing Color for ls on Bash

Adapted from Paint your BASH (pdf) by Heike Jurik (Linux Magazine)

Have you noticed that on a tty console, the colour of the directory is dark blue. It is so hard to read the blue text. How do we change the colours?

Step 1: Pipe the information from Dircolors and save as .dircolors
$ dircolors -p > ~/.dircolors

Step 2: Change the contents of .dircolors
$ vim .dircolors

#------------------------------------------------
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 01;34 # directory
.........
#------------------------------------------------

Color Codes (Foreground):
00;30=Black
00;31=Red
00;32=Green
00;33=Brown
00;34=Blue
00;35 Magenta
00;36=Cyan
00;37=White

01;30=Grey
01;31=Light Red
01;32=Light green
01;33=Yellow
01;34=Light Blue
01;35=Pink
01;36=Light Cyan
01;37=Light Gray


Introduce DirColors to the new configuration
$ dircolors -b ~/.dircolors

Horray done.


Articles:

1 comment:

Neil Bauers said...

remember also to

source ~/.bashrc

The new colours are now in effect without having to log out and back in.