3

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:
LS_COLORS='di=34;01:fi=0:ln=96;1:pi=36;1:so=31;1:bd=5:cd=5:or=31:mi=0:ex=35'

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.

1 Answer 1

6

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.

2
  • Ah. So it actuallly doesn't set the color based on the the actual file type, it does just check filetypes
    – Falmarri
    Oct 10, 2010 at 22:53
  • 1
    It sets the color based on the file extension
    – PiedPiper
    Oct 10, 2010 at 23:48

You must log in to answer this question.

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