LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-14-2005, 04:14 AM   #1
learnfast
Member
 
Registered: Mar 2005
Location: berlin
Distribution: Redhat 9, Fedora 3
Posts: 70

Rep: Reputation: 15
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.
 
Old 03-14-2005, 04:17 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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.
 
Old 03-14-2005, 04:27 AM   #3
learnfast
Member
 
Registered: Mar 2005
Location: berlin
Distribution: Redhat 9, Fedora 3
Posts: 70

Original Poster
Rep: Reputation: 15
- 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.
 
Old 03-14-2005, 04:36 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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.
 
Old 03-14-2005, 05:12 AM   #5
learnfast
Member
 
Registered: Mar 2005
Location: berlin
Distribution: Redhat 9, Fedora 3
Posts: 70

Original Poster
Rep: Reputation: 15
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?
 
Old 03-14-2005, 05:24 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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).
 
Old 03-14-2005, 06:09 AM   #7
learnfast
Member
 
Registered: Mar 2005
Location: berlin
Distribution: Redhat 9, Fedora 3
Posts: 70

Original Poster
Rep: Reputation: 15
- 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.
 
Old 06-22-2009, 08:58 AM   #8
BlueOval1
LQ Newbie
 
Registered: Jun 2009
Posts: 1

Rep: Reputation: 0
In red hat 5 I noticed two files in /etc directory.
DIR_COLORS
DIR_COLORS.xterm
 
Old 05-12-2011, 08:34 PM   #9
nlsteffens
LQ Newbie
 
Registered: May 2011
Posts: 3

Rep: Reputation: 0
DIR_COLORS.xterm

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

Last edited by nlsteffens; 05-16-2011 at 11:24 PM.
 
Old 04-13-2012, 03:41 AM   #10
simransab
LQ Newbie
 
Registered: Sep 2009
Posts: 23

Rep: Reputation: 15
run: type ls
if it returns : ls is aliased to `ls --color=tty'
run: unalias ls
 
Old 04-13-2012, 07:29 AM   #11
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
Do you know how old this thread is? Why not let is rest in peace?
 
Old 12-01-2012, 09:03 AM   #12
bashMe
LQ Newbie
 
Registered: Nov 2012
Posts: 9

Rep: Reputation: Disabled
Talking

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


Reply

Tags
color, dircolors, ls



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change screen colors lewisdw Linux - Newbie 1 08-12-2004 06:58 AM
Aterm - change default colors ar1 Linux - Software 9 04-19-2004 03:10 PM
How do you change the colors in emacs? ArmedCoder Linux - Software 1 10-26-2003 07:12 PM
how do i change text colors rcjoyner Linux - Newbie 3 10-16-2003 11:05 AM
Gnome - change resolution and colors? elfpower Slackware 2 02-13-2003 10:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration