You can override the default colors by defining the environment variable LS_COLORS (or LS_COLOURS ). The format of this variable is reminicent of the termcap(5) file format; a colon-separated list of expressions of the form "xx=string", where "xx" is a two-character variable name. The variables with their associated defaults are:
no 0 Normal (non-filename) text fi 0 Regular file di 32 Directory ln 36 Symbolic link pi 31 Named pipe (FIFO) so 33 Socket bd 44;37 Block device cd 44;37 Character device ex 35 Executable file mi (none) Missing file (defaults to fi) or (none) Orphanned symbolic link (defaults to ln) lc ee[ Left code rc m Right code ec (none) End code (replaces lc+no+rc)
You only need to include the variables you want to change from the default.
File names can also be colorized based on filename extension. This is specified in the LS_COLORS variable using the syntax "*ext=string". For example, using ISO 6429 codes, to color all C-language source files blue you would specify "*.c=34". This would color all files ending in .c in blue (34) color.
Control characters can be written either in C-style \-escaped notation, or in stty -like ^-notation. The C-style notation adds \e for Escape, \_ for a normal space characer, and \? for Delete. In addition, the \ escape character can be used to override the default interpretation of \, ^, : and =.
Each file will be written as <lc> <color code> <rc> <filename> <ec>. If the <ec> code is undefined, the sequence <lc> <no> <rc> will be used instead. This is generally more convenient to use, but less general. The left, right and end codes are provided so you don't have to type common parts over and over again and to support weird terminals; you will generally not need to change them at all unless your terminal does not use ISO 6429 color sequences but a different system.
If your terminal does use ISO 6429 color codes, you can compose the type codes (i.e. all except the lc , rc , and ec codes) from numerical commands separated by semicolons. The most common commands are:
0 to restore default color 1 for brighter colors 4 for underlined text 5 for flashing text 30 for black foreground 31 for red foreground 32 for green foreground 33 for yellow (or brown) foreground 34 for blue foreground 35 for purple foreground 36 for cyan foreground 37 for white (or gray) foreground 40 for black background 41 for red background 42 for green background 43 for yellow (or brown) background 44 for blue background 45 for purple background 46 for cyan background 47 for white (or gray) background
Not all commands will work on all systems or display devices.
A few terminal programs do not recognize the default end code properly. If all text gets colorized after you do a directory listing, try changing the no and fi codes from 0 to the numerical codes for your standard fore- and background colors.
Character set selection should be more system independent.
Using the colorization options disables the use of the tab character for column spacing unless the -T option is used; apparently some systems do not like tabs and color codes in conjunction.
If there was a single standard for the English language it would not be necessary to support redundant spellings.