When I start a terminal session on my Raspberry Pi some of the color schemes are downright annoying. Color can have the effect of eliciting feelings or invoking visceral reactions. The blue color against the black background makes my eyes water, burn and struggle to pull some form of discernible information from the dark void. Alas, mostly in vain.

The good news is that you don’t have to live with the default settings. Here’s an example of the defaults I get when logging in:

For me the dark blue is almost invisible. Linux allows you to configure different colors to represent directories, symbolic links, file types, etc. You can learn more by reading the manual page entry for dir_colors.

$ man dir_colors

To override the system settings you can create a file in your home directory called .dircolors. Start by setting this file to the default values. If you make a mistake or just want to get back to the default values you can remove this file.

$ dircolors -p > ~/.dircolors

If you edit this file, find the line that represents the color for directories and change it from Blue to Cyan.

# Change from BLUE
DIR 01;34 # directory

# change to CYAN
DIR 01;36 # directory

Once the change has been made you’ll need to log off and back in again, or reset the shell properties like this:

$ . ~/.bashrc

Another option might be to change all to values to a different theme like the solarize theme here:

$ wget -O .dircolors https://raw.githubusercontent.com/seebi/dircolors-solarized/master/dircolors.256dark
$
$ . ~/.bashrc
$ ls

For me the use of cornflower blue is more pleasing.

If you would like to get a better idea of what color values you might have available in the terminal, the colortest script is an excellent option. Running the script with the wide screen option will display the terminal color values which you can use as a guide.

Having a better handle in the colors of files, folders and the like there’s also the prompt string to consider. Changing the values in the prompt string is fairly straight forward. The values for PS1 are found in your .bashrc file. Here’s some examples below:

$ # Set prompt string to no colors
$ PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
$ 
$ # Annoying Blue directory color
$ PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\] '
$
$ # Cyan directory color
$ PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w \$\[\033[00m\] '

That should do it for the basics, I hope you enjoyed this post!

Mitch enjoys tinkering with tech across a wide range of disciplines. He loves learning new things and sharing his interests. His work interests run the gamut of: application integration, scalable secure clusters, embedded systems, and user interfaces. After hours you might find him dabbling in the hobby space with Raspberry Pi's, drones, photography, home wine making and other ferments.

Published by Mitch Dresdner

Mitch enjoys tinkering with tech across a wide range of disciplines. He loves learning new things and sharing his interests. His work interests run the gamut of: application integration, scalable secure clusters, embedded systems, and user interfaces. After hours you might find him dabbling in the hobby space with Raspberry Pi's, drones, photography, home wine making and other ferments.

Leave a comment

You can comment using your social media account

%d bloggers like this: