Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'd like to change the colors. The lime green hilighting on pale blue colored file names is killing my eyes.

I'm not sure if I'm using xterm or gnome or whatever, but I would like to change the default color scheme (preferable to something less offensive to my corneas) and have it stay changed (update my user profile).

Colors are nice, but sometimes it makes the text unreadable. I would settle for having no colors, standard B&W, if I can't have nice colors.

share|improve this question
    
Downvoted per the first down-vote criteria: "This question does not show any research effort" –  gWaldo Aug 14 '12 at 16:15
    
@gWaldo Thanks for downvoting a two year old questions. Really, great job. –  Josh K Aug 14 '12 at 16:47
    
Sadly your question did not improve with age. –  gWaldo Aug 14 '12 at 16:58
add comment

3 Answers

You'll need to configure your LS_COLORS export in your ~/.dir_colors (system wide at /etc/dir_colors)

See here for documentation: http://manpages.ubuntu.com/manpages/karmic/man5/dir_colors.5.html

::EDIT::

To make it stick:

  1. append this to your ~/.bashrc
    if [ "$TERM" != "dumb" ]; then
      [ -e "$HOME/.dir_colors" ] && 
      DIR_COLORS="$HOME/.dir_colors" [ -e "$DIR_COLORS" ] ||
      DIR_COLORS="" 
      eval "`dircolors -b $DIR_COLORS`" 
      alias ls='ls --color=auto'
    fi
  1. create/edit your ~/.dir_colors,

    for example with dircolors --print-database > .dir_colors

  2. Then force a read of your .bashrc file with:

    $: source ~/.bashrc

  3. Everything should be pretty.

share|improve this answer
    
How would I go about setting ~/,dir_colors to be loaded on login? Is there any way to load a profile of colors? I can't match colors to save my life. –  Josh K May 1 '10 at 5:21
    
See edit in comment. –  Dave Rickman May 1 '10 at 7:16
    
According to the man page you linked to, those files are ignored by GNU dircolors. On Ubuntu, your ~/.bashrc file should have a line like eval "dircolors -b`". You could try changing it to eval "dircolors -b ~/.dir_colors" and create that file by doing dircolors -p > ~/.dir_colors then edit it to change particular file types. –  Dennis Williamson May 1 '10 at 7:29
    
What files? .bashrc is your user-configurable bash shell. .dir_colors is your user configurable file for dircolors. Making it stick via the .bashrc file is going to be the only way to have it stick with every login unless you go global for everything. In which case, I don't want your pink directory colors. –  Dave Rickman May 1 '10 at 8:59
1  
What should I put in ~/.dir_colors? –  Josh K May 1 '10 at 14:59
show 4 more comments

How to change the colors of file listings in Linux shells

Summary

Linux interactive terminals (aka ssh terminal, konsole or console login) automatically choose colors for 'files', 'directories', 'hard links', 'soft links', 'pipes', 'sockets', 'filesystems', etc. You see these colors displayed when you type 'ls' to list file contents. Directories are usually blue, files are usually light grey. Different foreground/background colors are used for various kinds of filesystem objects.

Problem:

Your terminal displays directory links as dark blue when you type 'ls', and you want it to be light cyan so you can read it better.

Solution

Using your favorite editor, open this file: /etc/DIR_COLORS You should see something like this:

#NORMAL 00      # no color code at all
#FILE 00        # regular file: use no color at all
RESET 0         # reset to "normal" color
DIR 01;34       # directory
LINK 01;36      # symbolic link.  (If you set this to 'target' instead of a
                # numerical value, the color is as for the file pointed to.)
MULTIHARDLINK 00        # regular file with more than one link
FIFO 40;33      # pipe
SOCK 01;35      # socket
DOOR 01;35      # door
BLK 40;33;01    # block device driver
CHR 40;33;01    # character device driver
ORPHAN 01;05;37;41  # orphaned syminks
MISSING 01;05;37;41 # ... and the files they point to
SETUID 37;41    # file that is setuid (u+s)
SETGID 30;43    # file that is setgid (g+s)
CAPABILITY 30;41        # file with capability
STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44    # dir with the sticky bit set (+t) and not other-writable

Notice the 4th line down starting with: "DIR". That is the color for your Directory links. If you want more info about what the codes mean visit this site:

http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html

Notice the code for DIR is '01;34'. the 34 means dark blue. You may be tempted to just edit this file /etc/DIR_COLORS right where it sits. DON'T do that. Because then you'll be changing the colors for EVERYONE who logs into this computer. You'll have to make a copy of this in your own directory so only your login is affected.

How to change the directory colors for your user

Copy /etc/DIR_COLORS into your home directory with this command:

cp /etc/DIR_COLORS /home/yourusername/.dir_colors

Open up your /home/yourusername/.dir_colors in your favorite editor and edit the line that looks like this:

DIR 01;34       # directory

And change it to this;

DIR 01;36       # directory

34 is the code for blue, 36 is the code for cyan. Save the /home/yourusername/.dir_colors You'll have to logout/login for the settings to take effect. (sourcing your profiles won't suck in the changes). Once you logout/login, run the command 'ls'. The directories should show up with cyan instead of blue. Like this:

Before:

enter image description here

After:

enter image description here

share|improve this answer
add comment

Assuming you're using gnome-terminal, you can select Edit > Profiles... and select the profile that's current (e.g. Default) and click Edit (or click New and enter the name of a new profile - if you do this then you'll need to later set it as the "Profile used when launching a new terminal"). Now you can click on the Colors tab where you can set the background and foreground colors and manipulate the color palette (including selecting among built-in schemes).

You might try the White on black foreground/background scheme and the Tango palette (which has colors that are a bit muted).

share|improve this answer
    
If he is running the server edition, then there shouldn't be a desktop environment. –  Dave Rickman May 1 '10 at 7:18
    
@freedom_is_chaos: But he mentions xterm and "gnome". –  Dennis Williamson May 1 '10 at 7:31
    
I figured he was guessing more at what shell he is running rather than program because he was running the server version. –  Dave Rickman May 1 '10 at 9:01
    
There is no desktop environment, I only mention xterm and gnome because those are various references to things I found in my search for this. –  Josh K May 1 '10 at 12:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.