Neither Terminal or iTerm on Mac is white/black color by default, which looks tedious. What if different entries shown in different colors?
Fortunately, we can do this just by writing a configuration file, then the terminal console or iTerm can look like this:
So how can we do this?
It’s very simple, just create a file named ~/.bash_profile
, and fill it with the following content:
1 2 3 4 5 6 7 8 9 10 11 |
|
If you are not satisfied with that color, you can change the value of LSCOLORS.
The value of LSCOLORS describes what color to use for which attribute when colors are enabled with CLICOLOR. This string is a concatenation of pairs of the format fb, where f is the foreground color and b is the background color.
The color designators are as follows:
- a black
- b red
- c green
- d brown
- e blue
- f magenta
- g cyan
- h light grey
- A bold black, usually shows up as dark grey
- B bold red
- C bold green
- D bold brown, usually shows up as yellow
- E bold blue
- F bold magenta
- G bold cyan
- H bold light grey; looks like bright white
- x default foreground or background
The order of the attributes are as follows:
- directory
- symbolic link
- socket
- pipe
- executable
- block special
- character special
- executable with setuid bit set
- executable with setgid bit set
- directory writable to others, with sticky bit
- directory writable to others, without sticky bit
I’m tring to write my blog in English, please leave a message to me if you find any mistake, I’ll appreciate it :)
我会尽量用英文来写博客,如果你发现任何语法错误或表达错误,不要犹豫,请帮忙斧正,感激不尽!