LS_COLORS: how to change the colors of file listings in Linux shells

Quick Linux tip: Linux interactive terminals (e.g. for ssh or console login) automatically color-code files, directories, symlinks etc. when you list them using ls or other commands. These colors are set from the file /etc/DIR_COLORS, which is read by the scripts in /etc/profile.d on login.

The default blue for directories in RH Linux (and clones) is almost impossible to read on some monitors. Change it to yellow:

cp /etc/DIR_COLORS ~/.dir_colors

This copies the DIR_COLORS file to your home directory. It will be read when you login to set your personalized colors.

nano ~/.dir_colors

this opens an easy-to-use editor with your personalized color file. Page down to the line that reads

DIR 01;34

change it to

DIR 01;33

save the file (control-O), log out and log back in again. Your directories will now list in high-contrast yellow instead of the unreadable dark blue.

Leave a Reply

Your email address will not be published. Required fields are marked *