Bash Colors
The colors in a terminal window – the Bash colors are important. We have all gone to the command line and typed in ls to get a listing of all that is in a certain directory. Did you ever notice that the colors were color coded to different types of files? With the background of the terminal window being black some of the letters don’t show up well, like those in blue. Have you ever wondered how to change them? I did too, so I did a bit of research and here is what I came up with.
What are the Bash Colors at Default
Before we change anything we need to know what things are right now. To do this we go to the terminal window and type in: echo $LS_COLORS .
What does it mean?
Number | Font |
00 | Normal – No change |
01 | Bold |
04 | Underline |
05 | Blinking |
Color Name | Font color | Background color |
Black | 30 | 40 |
Red | 31 | 41 |
Green | 32 | 42 |
Yellow | 33 | 43 |
Blue | 34 | 44 |
Magenta | 35 | 45 |
Cyan | 36 | 46 |
White | 37 | 47 |
The next thing to do is to type dircolors -p into the terminal. This will give you what directory colors and the mime types that are associated with them as default values. If you want a “record” that you can keep or print out you can redirect the output to a text file. Type in dircolors -p > mycolors.txt.
Make the changes you want to the Bash colors. Add the following to your .bashrc (don’t forget to include the path to the mycolors.txt file).
eval ‘dircolors /path/to/mycolors.txt’
Mycolors.zip – This will give you a good idea of where to begin. I changed the shell scripts to a bright yellow; you can change other things to your heart’s content. The script is commented so you can follow along and make changes.
To learn more about mime types go here.