Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to set up my color scheme for ls, and I'm having trouble finding information about exactly what parameters I have to work with, or where those come from. And especially setting colors for types of files instead of based on filetype.

For example, this is my current color scheme:

I found those parameters (di, fi, etc) from a website tutorial. But where do those come from? Can I set custom ones? I know I can set colors like *.jpg=0 and such. But is there a way to do it based on types of files? I specifically want to set compressed file types, but if I have to do it by recognizing filetypes, I feel there's a better way.

share|improve this question
up vote 5 down vote accepted

Try the dircolors command. It can print the default colors to standard output. You can use this output to modify the defaults and generate a suitable "LS_COLORS=...-line" again with dircolors. Say you want all compressed files which are bright red by default to be bright green instead, then you'd do

dircolor -p > dircolors.txt
vim dircolors

then you scroll to the section including the compressed files and modify the values from 01;31 to 01;32. Then call

dircolors -b dircolors.txt

to generate the "LS_COLORS=..."-line for you with the modified values.

share|improve this answer
Ah. So it actuallly doesn't set the color based on the the actual file type, it does just check filetypes – Falmarri Oct 10 '10 at 22:53
It sets the color based on the file extension – PiedPiper Oct 10 '10 at 23:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.