November 19, 2016

The method of changing directory/file color at linux

□ If the value of the LS_COLORS environment variable is changed, the color of the directory/file changes when querying file with ls command

□ LS_COLORS environment variable grammer
○ LS_COLORS="[File type]=[Attribute];[Color]:[File type]=[Attribute];[Color]"
○ File type
- di : directory
- fi : file
- ex : exe
- ln : linker file
- pi : name pipe
- so : soket
- no : text
- bd : block device
- cd : charicter device
○ Attribute
- 00 : No Attribute
- 01 : Bold
- 04 : Underline
- 05 : Blink
○ Color(3x : Letter color / 4x : Background color)
- 30 : black
- 31 : red
- 32 : green
- 33 : yellow
- 34 : blue
- 35 : magenta
- 36 : sky
- 37 : white or gray

□ Usage example
○ Add the following string to the end of ~/.bashrc file or input the following string in a current shell
○ export LS_COLORS="di=00;36:fi=00;37"