Colorful Linux: A Guide to Customizing Directory and File Colors in Your Terminal

saklaniaman
2 min readJul 5, 2023

Have you ever wanted to add a splash of color to your Linux terminal? Imagine easily distinguishing directories and files based on vibrant hues, making your command-line experience both visually appealing and efficient. In this guide, we will explore how to customize the colors of directories and files in Linux, empowering you to personalize your terminal and enhance your workflow. Get ready to bring your Linux environment to life with a vibrant palette of colors!

Customization Steps: To customize directory and file colors, follow these steps:

Step 1: Set the LS_COLORS Environment Variable: The LS_COLORS environment variable determines the colors used by the ‘ls’ command to display various file types. You can set this variable using the ‘export’ command in your terminal. For instance:

export LS_COLORS="di=0;31:fi=0;35"

In the above example, ‘di=0;31’ sets the color for directories to red, and ‘fi=0;35’ assigns the color for regular files as magenta. Feel free to adjust the color codes to your liking.

Step 2: Customize Colors for Other File Types: Apart from directories and regular files, you can also assign colors to other file types like symbolic links, archives, images, etc. The LS_COLORS variable follows a specific pattern to define colors for each type. For instance, to customize the color for symbolic links, you would use ‘ln’ as the file type code. Here’s an example:

export LS_COLORS="di=0;31:fi=0;35:ln=0;36"

In this case, ‘ln=0;36’ sets the color for symbolic links to cyan. You can explore the LS_COLORS documentation or resources specific to your terminal emulator for a comprehensive list of file types and their respective codes.

Step 3: Experiment and Fine-Tune: Customization is subjective, so feel free to experiment with different color combinations and attributes. Modify the LS_COLORS environment variable as per your preferences, trying out various color codes and effects. This iterative process will help you find the perfect color scheme that suits your needs and enhances your terminal experience.

Conclusion: By customizing directory and file colors in your terminal, you can bring a personalized touch to your command-line environment. The ability to quickly identify different file types improves navigation and productivity. With the steps outlined in this guide, you now have the knowledge to tailor the colors to your liking. So go ahead, explore the possibilities, and create a visually appealing and efficient terminal experience.

--

--