Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redhat Linux - change directory color

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?

like image 296
saravana_pc Avatar asked Nov 24 '11 09:11

saravana_pc


People also ask

How do I change the color of a folder in Linux?

For example, di=0;34, here di means the color should be applied to directories. 0 means it's a normal color, and 34 means the color is green. If you want bold green font for the directories, the color code should be di=1;34.

How do I change Colors in Linux?

“tput setaf” sets foreground color, “tput setab” sets background color, and “tput sgr0” resets all the settings to terminal default. There are 8 standard colors encoded in numbers from 0 to 7 (in order: black, red, green, yellow, blue, magenta, cyan, white).


2 Answers

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.

like image 93
William Pursell Avatar answered Oct 27 '22 00:10

William Pursell


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.

like image 24
sarnold Avatar answered Oct 26 '22 23:10

sarnold