All the color settings is in this file: /etc/DIR_COLORS. In example below I will show how to change the color for  directory listing. The default font color for directory/folder is dark blue with black background so I want to change it so that it is easier to read.

The steps as below

1) use any editor to modify the file, example : vi /etc/DIR_COLORS

2) Scroll down until you find this:     DIR XX;XX       # directory (XX = 2 digits number)

3) Change the font color using the code shown below. For example if I want the folder to be shown as yellow with black background i will change the line to  DIR 33;40       # directory

4) Save the file. If using vi use this command: !wq <enter>

5) To have the color to have effect in root ,  copy the file to root directory

cp /etc/DIR_COLORS /root/.dircolors

6) To have the color to have effect in user account, copy to home directory

cp /etc/DIR_COLORS /home/.dircolors

7) Exit from your shell window, login again.  Type ls to see the effect, Volla!

Besides directory, you can change other color settings in the same file.

About these ads