Saturday, November 19, 2011

Setting the Background color in Linux Shell

1) You can  do the  color settings is in this file: /etc/DIR_COLORS.

2)  Set the code in the line DIR XX;XX     

3) Change the font color using the code below with examples

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

     cp /etc/DIR_COLORS  /root/.dircolors

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

     cp /etc/DIR_COLORS  /home/.dircolors

6)  To use customized colors you must use special string combination:

        FILE-TYPE: is file type like DIR (for directories)
  


 Attribute codes:
       
        00=none
        01=bold
        04=underscore
        05=blink
        07=reverse
        08=concealed
Text color codes:
       
        30=black
        31=red
        32=green
        33=yellow
        34=blue
        35=magenta
        36=cyan
        37=white
  
Background color codes:
       
        40=black
        41=red
        42=green
        43=yellow
        44=blue
        45=magenta
        46=cyan
        47=white

For example  entry should look as follows:
DIR 01;36


# vi /etc/DIR_COLORS

Modify DIR entry
From:

DIR 01;36 # default is Magenta

To:

DIR 01;36;40 # default is Magenta with Black background

No comments: