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.


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.

  • 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
  • 1
    It sets the color based on the file extension – PiedPiper Oct 10 '10 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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