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 use putty with a black background and was wondering if there was or is a way to change the colors of the dirs which are dark blue.

i noticed DIR_COLORS.xterm and DIR_COLORS

do they play this role?

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

It depends on the version of Linux your using, for example on Ubuntu you edit the Bash File while on others you edit the DIR_COLORS.

CentOS/RHEL/Fedora

Step 1 - Copy the DIR_COLORS to your home folder or skip this for all accounts.

cp /etc/DIR_COLORS ~/.dir_colors

Step 2 - Edit the DIR_COLORS (If you copied it to your home folder, otherwise just vi dir_colors

vi ~/.dir_colors

Step 3 - Find

DIR 01;34     # directory

Step 4 - Replace with (Change the 33 with the color you want)

DIR 01;33     # directory

You may need to do this in the Xterm file as well, but generally that is more local.

Ubuntu

Step 1 - Ubuntu Backup the Bash File First

sudo cp .bashrc .bashrc-backup

Step 2 - Then nano the Bashrc File

sudo nano .bashrc

More help for Ubuntu users can be found here.

http://help.ubuntu.com/community/CustomizingBashPrompt

share|improve this answer
1  
For Ubuntu, you shouldn't use sudo to edit your own .bashrc. That said, the guide you linked just covers colorizing the prompt, not ls. It appears that Debian-type distros don't use ~/.dir_colors for ls, they use the $LS_COLORS environment variable which can be setup with a little program called dircolors –  DerfK Jan 7 '13 at 20:18
add comment

PuTTY uses its own colour specs for emulating X terminals. It is under the Window -> Colours category in the main configuration window you get on startup. In the section 'Adjust the precise colours PuTTY displays' you can edit entries in the 'Select a colour to adjust' box. The usual directory colour, for example, is ANSI blue. I find this too dark, so I lighten it to (74,74,255).

To enable colours in a standard bash session under most distros (and certainly Debian-like things such as Ubuntu,) first test for the existence of the dircolors executable, then look for a local override .dircolors. If found, run dircolors with the local file and if not use the system defaults.

if [ -x /usr/bin/dircolors ]; then
   test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
fi

The -b flag means emit Bourne shell compatible colourisation rules. To alter the colours themselves, you will need to provide an X11 resource file with the overrides you want. Put this in ~/.Xresources and add lines like *xterm*color12: #1e90ff. This will get merged into your X resource database on next login. You will need to experiment to see which colour gets mapped to which file type.

share|improve this answer
1  
OMG thank you for sharing this. –  Daniel Sokolowski Sep 28 '13 at 1:05
add comment

You can modify .dircolors.xterm, for instance, using the following codes... In your case, if you want a different directory color, change from "01;34" to something like "01;31".

# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
NORMAL 00       # global default, although everything should be something.
FILE 00         # normal file
DIR 01;34       # directory
LINK 01;36      # symbolic link
FIFO 40;33      # pipe
SOCK 01;35      # socket
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
share|improve this answer
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.