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;

  1. Execute command "dircolors > ~/.dircolors";
  2. Generated file "~/.dircolors" is self-documented, customize it to your liking;
  3. Add these lines to your ~/.bashrc file or equivalent:
    if [ -f ~/.dircolors ]; then
       eval $(dircolors ~/.dircolors)

That's it!

P.S. You can also disable color output altogether by doing "unalias ls".


Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?