Changing Directory Listing (ls) in RHEL

This is a follow-up to my previous post.

The Problem
The ls command in Redhat Enterprise Linux (RHEL) by default uses the dark blue to show directories. This color is hard to see, especially on laptops with dim screens. I would like an easy way to change that.


The Solution

The solution is similar to that in my previous post, but Redhat makes it a little easier. Here are the steps:

  1. Create a text file containing the color definitions by issue the following command: dircolors > ~/.dircolors
  2. Edit the file ~/.dircolors and change the colors to your taste
  3. Exit the shell and login again to see the changes

Explanation

When a user logs in, RHEL executes the start-up files in the /etc/profile.d directory. Among those start-up files, colorls.sh (for borne-family shells) and colorls.csh (for csh-family shells) are responsible for setting the ls colors. The scripts look in the user’s home directory for a file called .dircolors to overwrite the colors. By creating and tweaking this file, the user can change the colors of the ls command to his or her taste. Personally, I prefer the bright yellow for directory:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s