
-C|--color[=WHEN]参数的作用是让每栏由上至下列出项目,同时控制是否使用色彩分辨文件。WHEN 可以是"never"(默认)、"always"或"auto"其中之一。
文件不同的颜色表示文件不同的类型,下面是linux系统默认不同类型文件所使用的颜色:
白色:表示普通文件
蓝色:表示目录
绿色:表示可执行文件
红色:表示压缩文件
浅蓝色:链接文件
红色闪烁:表示链接的文件有问题
黄色:表示设备文件
灰色:表示其它文件
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
Linux在terminal中,目录的默认显示颜色为蓝色,在黑色背景下很难看清楚。于是今天在公司的一台测试机上参照网上的教程把目录的颜色给换了。
具体 *** 作方法如下:
# cd ~
# cp /etc/DIR_COLORS ./
# mv DIR_COLORS ./.dir_colors
# vi .dir_colors
编辑.dir_colors文件找到“DIR 0134 # directory”,将 34改为36。
按照颜色对应的数字,可以把目录显示颜色改成其他的。
同样其他的显示效果(包括背景)也可以参照说明进行修改。
这样就可以定制自己的linux下命令行方式下的个性化显示效果了。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)