HostOnNet Blog

Change ls color in bash CentOS/RHEL/Fedora

By default CentOS/RHEL show directorys in ls listing in dark green.

With dark color, i found it difficult to read directory names.

To change directory color, do

cp /etc/DIR_COLORS ~/.dir_colors

Edit ~/.dir_colors

vi ~/.dir_colors


DIR 01;34     # directory

Replace with

DIR 01;33     # directory

Now log off and login (or run bash), you will see directory colors changed as follows.

Posted in Linux

  • MASC

    Hi. I’m new to Linux, and I’m wondering why it is that you have to copy this file to the individual profiles to get the color change to work. I see that the instructions in the actual file say to do this, I’m just wondering why. If you wanted to make this change system wide for all users, why can’t you simply edit the /etc/DIR_COLORS file?

  • admin

    @MASC yes, editing /etc/DIR_COLORS will change colors for all users. I just wanted for one user.

  • So this the same in CentOS, Fedora, and Redhat?

  • admin

    Yes, it is same for CentOS, Fedora, and Redhat.

  • Rafa

    Thanks indeed. It’s stupid, but I was having real pain reading my dirs. Simple but hard for newbies to find out withou google 🙂