您的位置:首页 > 其它

终端下更改文件显示颜色

2013-06-18 15:52 260 查看
本博文为原创,遵循CC3.0协议,转载请注明出处:/article/8087640.html

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

终端下开启ansi标准颜色显示,可以通过以下方式手动更改目录、普通文件等的显示颜色

/etc/DIR_COLORS文件详尽描述了终端下的文件颜色设置,

# 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


按注释所述,选择替换的颜色后,保存文件。(系统默认/etc/DIR_COLORS文件为只读,确保先获得写权限)

eval `dircolors /etc/DIR_COLORS`


执行以上命令,使新设置的颜色生效。

Mac下参考如下文章:

MAC+iTerm定制目录显示颜色和提示符

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: