Redhat Linux - change directory color

29,725

Solution 1

To specify the colors of the output of ls, you need to set LS_COLORS. In your .zshrc, try adding:

LS_COLORS="$LS_COLORS:di=00;33"

34 is blue, 33 is ... yellowish. Change that number and find what you like.

Use dircolors to get a feel for what LS_COLORS should look like and add -p to see a color list.

Solution 2

Joachim's answer is good for fixing the specific issue of directories, but if any other utilities output using the "blue" color, you will find them just as unreadable.

Different terminal emulators have different settings for changing the colors; my terminal emulator of choice reads X resources to determine what colors to use:

      URxvt.color0:   #000000
      URxvt.color1:   #A80000
      URxvt.color2:   #00A800
      URxvt.color3:   #A8A800
      URxvt.color4:   #0000A8
      URxvt.color5:   #A800A8
      URxvt.color6:   #00A8A8
      URxvt.color7:   #A8A8A8

      URxvt.color8:   #000054
      URxvt.color9:   #FF0054
      URxvt.color10:  #00FF54
      URxvt.color11:  #FFFF54
      URxvt.color12:  #0000FF
      URxvt.color13:  #FF00FF
      URxvt.color14:  #00FFFF
      URxvt.color15:  #FFFFFF

color4 is the blue in question; I have mine set like this:

URxvt.background:       #000000
URxvt.foreground:       gray75
URxvt.color3:           DarkGoldenrod
URxvt.color4:           RoyalBlue
URxvt.color11:          LightGoldenrod
URxvt.color12:          LightSteelBlue
URxvt.color7:           gray75
URxvt.colorBD:          #ffffff
URxvt.colorUL:          LightSlateGrey
URxvt.colorIT:          SteelBlue
URxvt.cursorColor:      grey90
URxvt.highlightColor:   grey25

This gives a black background, not-too-bright foreground, and most other colors are reasonable enough. (I too found the default blue unreadable.) I put these into my ~/.Xresources file, and they take effect after log in or after merging this file with the X resources database: xrdb -merge ~/.Xresources.

Of course, different terminals are configured differently. Check your terminal's manpage for more details on changing the colors of the usual colors.

Solution 3

You can see what is done in the global file, and then add it to your private ~/.profile (or similar file.)

Share:
29,725
saravana_pc
Author by

saravana_pc

Updated on August 06, 2020

Comments

  • saravana_pc
    saravana_pc almost 4 years

    I am using Redhat Linux and the problem I am facing is that the "blue" colour of the directories is hardly visible on the black background. I found some posts on the web which asks to change some settings in the file /etc/profile.d/colorls.sh and /etc/profile.d/colorls.csh. However, this will change the colour settings for everyone who logs into the system. Could someone please let me know how I can change the colour settings that will affect only me?

  • saravana_pc
    saravana_pc over 12 years
    Thanks for your reply. I am using zsh and hence my private settings are in the file .zshrc. Could you please let me know which global file I need to check and what settings I need to add?