It’s been a lot of years since colors were first introduced on the command line of Unix/Linux systems. But, yes, there was a time when terminal windows were simply black and white. Today, file names might show up in a number of different shades — green, red, blue, purple/magenta, or some other color — depending on the type of file (whether they are executable files, directories, images, etc.) or the file extensions. Sometimes you might just want to turn the colors off because they’re distracting you from what you want to pay attention to. At other times, they help you to instantly identify important file characteristics. In any case, there’s a lot that you can do to control the colors that are used and what they’re used for. Where do the colors come from? On many systems, it all begins with a file named DIR_COLORS. Check for /etc/DIR_COLORS on your system and you might see some of the settings that give birth to the colors you see when you list your files. $ head /etc/DIR_COLORS # Configuration file for the color ls utility # Synchronized with coreutils 8.5 dircolors # This file goes in the /etc directory, and must be world readable. # You can copy this file to .dir_colors in your $HOME directory to override # the system defaults. You can also look to see how the $LS_COLORS variable is configured in your account. $ set | grep COLOR LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36::di=5;35;42:' If that all looks like a pile of mumbo jumbo, take a deep breath. Notice that it’s full of settings separated by colons. And each colon-separated entry is is setting some value to either a number of a set of numbers separated by semi-colons. The numbers provide some visual function based on their ranges. Colors The first and most obvious range is the settings for the text colors. The numbers 30 through 37 represent the basic range of colors you can use. These are the basic colors. The range 30-37 represents the basic colors. There are also some additional colors and other numeric ranges that represent different character settings. The image above is a screen capture, so the colors should be close to what you would see. Other settings The settings shown below are for three separate image files types. All have the same settings — 01 and 35. The 35 will make the text purple (magenta). The 01 supposedly makes the font bold, but seems to not have any effect. What this section tells us is that all of these image types will look the same in a file listing. :*.jpeg=01;35:*.gif=01;35:*.bmp=01;35: Some of the other settings are for other effects — like underlining — and some work as expected. Effects 00 Default color 01 Bold 04 Underlined 05 Flashing text 07 Reversed 08 Concealed Here’s what some files using these settings look like on my screen. The underlined and reversed settings look just right. More colors The extra color range gives you an additional eight colors. The range 90-97 provides these. So, here are all the colors with a medium gray background so that you can see the white and black. Background colors There’s also a range for background colors. Most of these seem to work as expected. Wrap up File name colors, when used to display the things you care about are great. But one simple rule for coloring the text in your terminal windows is “if everything stands out, nothing stands out”. Used excessively, colors and effects can be more annoying than useful. Related content how-to How to find files on Linux There are many options you can use to find files on Linux, including searching by file name (or partial name), age, owner, group, size, type and inode number. By Sandra Henry Stocker Jun 24, 2024 8 mins Linux opinion Linux in your car: Red Hat’s milestone collaboration with exida With contributions from Red Hat and critical collaborators, the safety and security of automotive vehicles has reached a new level of reliability. By Sandra Henry Stocker Jun 17, 2024 5 mins Linux how-to How to print from the Linux command line: double-sided, landscape and more There's a lot more to printing from the Linux command line than the lp command. Check out some of the many available options. By Sandra Henry Stocker Jun 11, 2024 6 mins Linux how-to Converting between uppercase and lowercase on the Linux command line Converting text between uppercase and lowercase can be very tedious, especially when you want to avoid inadvertent misspellings. Fortunately, Linux provides a handful of commands that can make the job very easy. By Sandra Henry Stocker Jun 07, 2024 5 mins Linux PODCASTS VIDEOS RESOURCES EVENTS NEWSLETTERS Newsletter Promo Module Test Description for newsletter promo module. Please enter a valid email address Subscribe