How to set the colors displayed with the ls command

the output of the ls command can be colorized for different file types including symbolic links, directories, and executables.


 * 1) Edit:
 * 2) * /etc/DIR_COLORS
 * 3) * for local user ~/.dir_colors
 * 4) add the line
 * 5) *COLOR [option]
 * 6) * where [option] can be none tty or all
 * 7) add line for your terminal program:
 * 8) *TERM [type]
 * 9) *where [type] is xterm, aterm, eterm, or what ever your terminal is

Seting colors
Below are the color init strings for the basic file types. A color init string consists of one or more of the following numeric codes: 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
 * Attribute codes:
 * Text color codes:
 * Background color codes:
 * NORMAL 00          # global default, although everything should be something.
 * FILE 00            # normal file
 * DIR 01;37          # directory
 * LINK 01;36         # symbolic link.  (If you set this to 'target' instead of a

# numerical value, the color will match the file pointed to)
 * FIFO 40;33         # pipe
 * SOCK 01;35         # socket
 * DOOR 01;35         # door
 * BLK 40;33;01       # block device driver
 * CHR 40;33;01       # character device driver
 * ORPHAN 01;05;37;41 # orphaned syminks
 * MISSING 01;05;37;41 # ... and the files they point to

This is for files with execute permission:
 * EXEC 01;32

List any file extensions like '.gz' or '.tar' that you would like ls to colorize below. Put the extension, a space, and the color init string. (and any comments you want to add after a '#')

.cmd 01;32 # executables (bright green) .exe 01;32 .com 01;32 .btm 01;32 .bat 01;32 .sh 01;32 .csh 01;32

using colors
Execute: For ls to display in color( --color=tty ) is applicable
 * ls --color
 * you can make an alias for 'ls'
 * alias ls='ls --color'

From HowTo Wiki, a Wikia wiki.