I thought ls colors are defined as


but, I recently found this where there are more colors and colors are specified as, e.g.:

.tar    00;38;5;61

for a 256-color terminal.

What does this definition mean?

1 Answer 1


The argument to a LS_COLORS directive is a string that is written to the terminal as part of an escape sequence. When displaying a file name, ls writes \e[, then the string associated with the file type, then m, then the file name, then \e[0m (where \e represents an escape character). This is the escape sequence that tells xterm and compatible terminals (which is most of them nowadays) to change colors and other text attributes (CSI Pm m in the documentation. ls doesn't care what the sequence of characters means or how many semicolons it contains.

Old terminals only supported 8 foreground colors, designated by the numbers 30 through 37. Terminals that support more colors use the escape sequence \e[38;5;Psm where Ps is a color number, or \e[38;2;Pr;Pg;Pbm where Pr, Pg, Pb are RGB values. These can be combined with other attributes, e.g. \e38;5;61;1m or \e38;2;95;95;175;1m for bold slate blue text.

  • This is unfortunately undocumented by dircolors, so that I spent some time looking at the ls source to see what I could do, until I found out that this was already possible. I've reported a bug, so that this could be documented: debbugs.gnu.org/cgi/bugreport.cgi?bug=33915
    – vinc17
    Commented Dec 30, 2018 at 2:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .