Friday, February 27, 2009
ls color
Modern Linux distributions are smart enough to support colored "ls" output and even enable that by default, but stupid enough not to adjust it in any way to current terminal color scheme. Default built-in colors "kind of work" for a black-on-white terminal, but should you try to make even small adjustment, some file types quickly become completely unreadable.
At the same time, procedure to customize these colors, while not complicated, is rather poorly documented.
Here are a few simple steps to follow;
- Execute command "dircolors > ~/.dircolors";
- Generated file "~/.dircolors" is self-documented, customize it to your liking;
- Add these lines to your ~/.bashrc file or equivalent:
if [ -f ~/.dircolors ]; then eval $(dircolors ~/.dircolors) fi
That's it!
P.S. You can also disable color output altogether by doing "unalias ls".
Labels: linux