教你如何改变终端背景与命令的颜色

来源:互联网 发布:好听的编程项目名称 编辑:程序博客网 时间:2024/05/17 03:26

转载自:http://www.macx.cn/thread-2037316-1-1.html

终端不仅可以使用黑白颜色,我们还可以自定义它的命令与背景的颜色,帮助识别不同种类的命令,下面是一些小方法,大家可以尝试下。

 
打开终端输入并且键入

  1. nano .bash_profile
复制代码
回车

 
再次键入
黑色背景用以下命令
  1. export CLICOLOR=1
  2. export LSCOLORS=GxFxCxDxBxegedabagaced
复制代码
白色背景用以下命令
  1. export CLICOLOR=1
  2. export LSCOLORS=ExFxBxDxCxegedabagacad
复制代码
Control+O然后回车
 
这时新建一个终端窗口,输入命令,变色了吧。
例如,输入
  1. ls
复制代码
或者
  1. ls -la
复制代码

 
改变背景颜色可以进入终端偏好设置-设置-窗口-背景颜色


自定义终端命令颜色

"exfxcxdxbxegedabagacad"是终端默认的,下面给出的各个字母代表指代的不同颜色

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


LSCOLOR上方各个字母的次序指代的不同命令:

1. directory
2. symbolic link
3. socket
4. pipe
5. executable
6. block special
7. character special
8. executable with setuid bit set
9. executable with setgid bit set
10. directory writable to others, with sticky bit
11. directory writable to others, without sticky

show 一下小成果:


原创粉丝点击