Personalize Your Linux Experience: Changing Directory Colors in RHEL 9 Linux Made Easy

shubhang Khandelwal
3 min readJul 9, 2023

--

Introduction: In the realm of Linux customization, even the smallest visual enhancements can make a significant impact on our overall experience. One such customization is changing the color of the DIR (directory) entries. In this blog post, we will delve into the art of transforming DIR colors using the powerful Vim editor in RHEL-9.2. Brace yourself for a journey of vibrant exploration as we guide you through the process of modifying the DIR_COLORS file to bring a splash of color to your Linux directory listings.

The current color of my Linux’s Dir

You can see below the color of my DIR with the use of ls.

the current color is red

We’ll do some changes in DIR_COLORS

Now this dir DIR_COLORS is in /etc/DIR_COLORS. we will be using Vim text editor for editing.
here is the syntax below

vim /etc/DIR_COLORS

Now this will open below, and here search for the DIR tag here you have to choose according to what you like here are some additional color tags.

               0   to restore default color
1 for brighter colors
4 for underlined text
5 for flashing text
30 for black foreground
31 for red foreground
32 for green foreground
33 for yellow (or brown) foreground
34 for blue foreground
35 for purple foreground
36 for cyan foreground
37 for white (or gray) foreground
40 for black background
41 for red background
42 for green background
43 for yellow (or brown) background
44 for blue background
45 for purple background
46 for cyan background
47 for white (or gray) background

Now when you write the tags the color will also show up according to the tags.

Now when you are done press ESC then write “ :wq
NOTE: if some error show up, press :wq!

Now close the terminal and open a new one and press cmd LS then changes will be shown and these changes are permanent i.e will persist even after the reboot

As you can see color is changes

FUN TASK: you can also change the color of the folder or software or any other file with DIR_COLROS try editing them and customize your default Linux visualization

Conclusion

You can change the color of Files or Dir in Linux by editing into /etc/DIR_COLORS and then customizing it according to your likes and dislikes.

Guys this was all for today, keep coding and keep coloring.

--

--