Customizing the colors for ls
The command line tool
ls
can be configured to use different colors for different file types, e.g. blue directories or red archive files. To use the predefined color scheme just activate this feature in your personal settings. For the Bourne Again Shell (bash) edit the file
~/.bashrc
with your favourite editor and add (or uncomment) the following lines:
eval `dircolors -b`
alias ls='ls --color=auto'
If you don't like the predefined colours, you can change the configuration to achieve an esthetically pleasing impression.
- Create your personal configuration file with a command like:
dircolors --print-database > ~/.dircolorsrc
Notice that the file name is only an example, feel free to choose another name.
- Add the path name of your new configuration file to your personal settings in the file
~/.bashrc
like this:
eval `dircolors -b ~/.dircolorsrc`
- Edit
~/.dircolorsrc
to customize the appearance of different files, one line per type. The content of the configuration file is quite self-explanatory:
- Show flac files in cyan with:
.flac 36
- Display orphaned symbolic links underlined and blinking (this is pretty pesky) with:
ORPHAN 04;05
- To test your settings you can reread the personal configuration with:
source ~/.bashrc
(or even shorter with: . ~/.bashrc
)
--
StefanHaller - 18 Feb 2008