Thursday, October 11, 2012

How to change font and background color in shell terminal

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) To have the color to have effect in root ,  copy the file to root directory
cp /etc/DIR_COLORS /root/.dircolors

or

To have the color to have effect in user account, copy to home directory
cp /etc/DIR_COLORS /home/.dircolors


2) use any editor to modify the file (.dircolors)


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


4) 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


5) 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.

No comments:

Post a Comment