Ubuntu: What do the different colors mean in ls?
Channel: Roel Van de Paar
Date: 2019-06-10

Ubuntu: What do the different colors mean in ls?


Question: What do the different colours in Ubuntu's ls command mean? For example, when I
type the ls command in one of my folders, I get one of the files in light
green, the other (which is a folder) in blue with green highlighting.
What do those colours mean, and there is any manual about all the colours?

Solutions Sample (Please watch the whole video to see all solutions, in order of how many people found them helpful):

== This solution helped 17 people ==
None of the answers here include the 256 color options in the latest versions
of Ubuntu. I'm color deficient (some colors give me trouble near each other) so
the default blue directory on black is real hard for me to read. What follows
is my research to change that.
Type dircolors -p |less to see your current color code.
The default .bashrc should already be configured not only to take advantage of
the system color code, but also one in ~/.dircolors so dump the dircolors
output to .dircolor so you can start with that using this command. dircolors -
p ＞ ~/.dircolors
Alternative: pick up a very similar 256 color dircolors from https://
raw.github.com/seebi/dircolors-solarized/master/dircolors.256dark project.
Grab this http://www.vim.org/scripts/script.php?script_id=1349 and run it with
the command colortest -w so you can see all the colors at once. Choose a color.
I like the orange #208. I want that to be the text color so using this info on
extended color codes, I can apply that.
So you have a color, now what. First we have to create the string.
The first number will be an attribute code, most likely 00, but if you want it
to blink go with 05:
     Pick an attribute code: 00=none 01=bold 04=underscore 05=blink
     07=reverse 08=concealed
Next pick append ;38;5; to that attribute code to indicate your text color to
get 00;38;5; and then append your color. I picked 208 so I get 00;38;5;208.
If you want to also put a background on it, pick another color (let's say 56)
with the colortest script and the append ;48;5; for the background and 56 for
the color to get a total string of 00;38;5;208;48;5;56.
So now you have it, what do you do with it?
vim ~/.dircolors and find the section you want to change (for me that is DIR)
to the string we determined above "00;38;5;208".
This won't apply immediately, you'll need to load the config. Use dircolors
~/.dircolors to the get code to set your LS_COLORS variable. You could just
paste that into your terminal session or you can close your terminal and reopen
it. You could also pipe that into a file and run it as a shell script.
You can do this same procedure with 16 colors. You don't need the special ;38;5
or ;48;5 stuff. Just toss the numbers into the string and enjoy the simplicity.
Thanks to http://www.mail-archive.com/bug-coreutils@gnu.org/msg11030.html and
seebi for their notes and code on this.

With thanks & praise to God! With thanks to all the many who have made this project possible! | Content (except music & images) licensed under cc by-sa 3.0 | Music & music license: https://www.bensound.com/royalty-free-music | Images & images license: https://stocksnap.io/license and others | With thanks to user wjandrea (https://askubuntu.com/users/301745), user Stefano Palazzo (https://askubuntu.com/users/1067), user Rinzwind (https://askubuntu.com/users/15811), user Rafid (https://askubuntu.com/users/7280), user muru (https://askubuntu.com/users/158442), user luk3yx (https://askubuntu.com/users/495653), user karthick87 (https://askubuntu.com/users/5691), user flickerfly (https://askubuntu.com/users/47461), and the Stack Exchange Network (http://stackoverflow.com/questions/17299). Trademarks are property of their respective owners. Disclaimer: All information is provided "AS IS" without warranty of any kind. You are responsible for your own actions. Please contact me if anything should be amiss at Roel D.OT VandePaar A.T gmail.com.