
在 Linux 系统中打开终端。
在终端内用鼠标右键单击,在d出的菜单中选择 编辑当前配置文件。
在d出的编辑窗口中,先取消 使用系统终端字体 前的小勾,然后单击字体组合框。
选择适当的 字体族、样式、大小,字体的效果可通过下方的 预览 窗口实时观看。满意后,单击 确定。
切换到编辑窗口的 颜色 选项卡。取消 使用系统主题中的颜色 前的小勾,然后单击内置方案后的组合框,挑选一种你喜欢的颜色方案。
linux下设置ls命令显示文件、文件夹颜色:1. LS_COLORS
用 dircolors -p 可以 看到缺省的颜色设置,包括各种颜色和“粗体”,下划线,闪烁等定义。
环境变量LS_COLORS时用来设置GNU ls的--color选项中的颜色的。
# 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:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 0134 # directory
故,要设置ls的颜色,则在SHELL的配置文件(以下是tcsh的配置文件:.tcshrc,对于bash略有不同)中添加下面一行:
setenv LS_COLORS 'no=00:fi=00:di=0133:ln=0136:pi=4033:so=0135:bd=403301:cd=403301:or=01053741:mi=01053741:ex=0135:*.cmd=0135:*.exe=0135:*.com=0135:*.btm=0135:*.bat=0135:*.sh=0135:*.csh=0135:*.tar=0131:*.tgz=0131:*.arj=0131:*.taz=0131:*.lzh=0131:*.zip=0131:*.z=0131:*.Z=0131:*.gz=0131:*.bz2=0131:*.bz=0131:*.tz=0131:*.rpm=0131:*.cpio=0131:*.jpg=0135:*.gif=0135:*.bmp=0135:*.xbm=0135:*.xpm=0135:*.png=0135:*.tif=0135:'
即可,可以参照上面的英文自行配置。
另:/etc/DIR_COLORS 文件为系统默认颜色参数配置文件
如果想修改定义自己的颜色参数配置文件,请执行如下 *** 作:
1) cp /etc/DIR_COLORS $HOME/.dir_colors
2) 修改中的颜色定义 $HOME/.dir_colors
2. CLICOLOR
# CLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。
setenv CLICOLOR 1
# LSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色
setenv LSCOLORS gxfxaxdxcxegedabagacad
LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:
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
LSCOLORS中,字母代表的颜色如下:
a 黑色
b 红色
c 绿色
d 棕色
e 蓝色
f 洋红色
g 青色
h 浅灰色
A 黑色粗体
B 红色粗体
C 绿色粗体
D 棕色粗体
E 蓝色粗体
F 洋红色粗体
G 青色粗体
H 浅灰色粗体
x 系统默认颜色
所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了
////////////////////////////////////////////
LSCOLORS 的含义:
LSCOLORS The value of this variable 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 greylooks like bright white
x default foreground or background
Note that the above are standard ANSI colors. The actual
display may differ depending on the color capabilities of
the terminal in use.
The order of the attributes are as follows:
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
bit
The default is “exfxcxdxbxegedabagacad”, i.e. blue fore-
ground and default background for regular directories,
black foreground and red background for setuid executa-
bles, etc.
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)