If you use PUTTY or Bitvise with Microsoft Windows “Xterm” terminals, you may find that the colors are less then desirable. Trying to read folders that are printed dark navy blue on a black background seems next to impossible. I can’t believe its the default color scheme for CentOS. Thankfully we found an article that has a solution and though we would repost the article here in our knowledge base.
Modify your global colors file by editing the file if its setup in your OS.
NANO $COLORS
The file is well documented, but fixing the directory color is easy, find the line the starts with “DIR” and change the numbers to read: 01;32
Ctrl+O to save, then hit enter, then Ctrl+X to exit, finally restart your console.
Add the following lines to the bottom of your ~/.bashrc file –
alias ls='ls --color' LS_COLORS='di=01;32:fi=0:ln=0:pi=0:so=0:bd=0:cd=0:or=0:mi=0:ex=0:*.rpm=0' export LS_COLORS
Don’t forget to restart your console before you try to LS and check for new colors.
The first line makes ls use the --color parameter by default, which tells ls to display files in different colours based on the setting of the LS_COLORS variable.
The second line is the tricky one, and what I have worked out so far has been by trial and error. The parameters (di, fi, etc.) refer to different Linux file types. I have worked them out as shown
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).
For example to define Bold Blue color for DIR file type, entry should look as follows:
DIR 01;34
These can even be combined, so that a parameter like:
di=5;31;42 in your LS_COLORS variable would make directories appear in flashing red text with a green background!
© Copyright 2024 Sethmatics Websites All Rights Reserved.