LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to change colors of ls listing? (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-change-colors-of-ls-listing-301378/)

learnfast 03-14-2005 04:14 AM

how to change colors of ls listing?
 
At my command line when I do a "ls" listing, it shows
me directories / files in different colors.

The navy blue on black is hard to see for directories.

Where is that file again when I can change the color of directories to something more visible?

Thanks.

druuna 03-14-2005 04:17 AM

Hi,

You don't mention your distro, so it could be in a different place:

/etc/DIRCOLORS (or /etc/dircolors)

The above is the file that holds the codes for (among other things) color settings.

Hope this helps.

learnfast 03-14-2005 04:27 AM

- I have Redhat 9.

- I edited the /etc/DIRCOLORS file and changed the DIR line so that it was the same color as FIFO (which is a nice orange/yellow), so now my DIRCOLORS file reads:

...
DIR 40;33
LINK 01;36
FIFO 40;33
...

- However, directories are still navy blue and FIFO entries are orange/yellow. (no change)

- I logged out and logged back in but it is the same.

How can I "apply these changes?"

Thanks.

druuna 03-14-2005 04:36 AM

Hi again,

After changing dircolors and starting a new (login) shell, changes should be visible immediately.

Take a look at your /etc/profile (and/or /etc/bashrc), it should be checked/started from there. Something like:

Code:

if [ -f "/etc/dircolors" ]
then
  eval $(dircolors -b /etc/dircolors)
  if [ -f "$HOME/.dircolors" ]
  then
    eval $(dircolors -b $HOME/.dircolors)
  fi
fi

Also take a look at man dircolors (especially the -b and -c option). You could try starting it by hand to check if that works.

Hope this helps.

learnfast 03-14-2005 05:12 AM

Ok, the colors changed but only after I copied
/etc/DIR_COLORS to /root/.dircolors and then
closed and opened the shell window.

Is there a way to change the colors GLOBALLY or was that supposed
to happen when I changed my /etc/DIR_COLORS file?

druuna 03-14-2005 05:24 AM

Hi,

Yep, changing /etc/DIRCOLORS is for global setting.

One thing I can come up with: Are you running a gui (as opposed to commandline login)? It could be that you need to restart the gui, although that's not 'the linux way' (my opinion).

learnfast 03-14-2005 06:09 AM

- In Fedora 3 and Redhat 9:

changing DIR_COLORS has no effect (both after exiting hello and logging out ) -- you have to copy this file to $HOME/.dircolors for it to have any effect

- In Suse 8.0:

changing DIR_COLORS takes effect the next time you enter the shell


I am using these all in GUI modes, in vmware environments.
OK, well, that's interesting. Thanks for your help.

BlueOval1 06-22-2009 08:58 AM

In red hat 5 I noticed two files in /etc directory.
DIR_COLORS
DIR_COLORS.xterm

nlsteffens 05-12-2011 08:34 PM

DIR_COLORS.xterm
 
Make the changes in DIR_COLORS.xterm for Fedora / Redhat.

simransab 04-13-2012 03:41 AM

run: type ls
if it returns : ls is aliased to `ls --color=tty'
run: unalias ls

linuxlover.chaitanya 04-13-2012 07:29 AM

Do you know how old this thread is? Why not let is rest in peace?

bashMe 12-01-2012 09:03 AM

Here is a good answer:
http://www.geekgumbo.com/2011/11/04/...he-bash-shell/


All times are GMT -5. The time now is 05:40 PM.