Friday, April 2, 2010

Change the color of ls

Thanks to Phillip Elvis for his useful tips !

The ls colors are controlled by the dircolors command. First, dump the current settings to a file using dircolors:

# dircolors --print-database > ~/.dircolors

Then edit the file ~/.dircolors. This contains all the current settings.

Now edit the ~/.dircolors file. The color you probably want to change is "file". It's set to 00 (probably white). I use 01 (bright white) for that. You can specify a background color too, with xx;xx. The .dircolors file will have instructions in it.

Save the file after editing it. To activate your changes, run dircolors like so:

# eval `dircolors ~/.dircolors`

And then you should have the new colors. Add this line to your .profile if you want these changes every time you log in.

Check the list of colors available there : http://www.cyberciti.biz/tips/where-is-color-of-ls-command-defined.html

Martin

No comments:

Post a Comment