1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > linux 设置.cshrc更改ls显示文件夹颜色

linux 设置.cshrc更改ls显示文件夹颜色

时间:2019-06-16 19:52:48

相关推荐

linux 设置.cshrc更改ls显示文件夹颜色

环境:linux csh

目的:深色背景下,ls显示的文件夹默认为蓝色,时间久了容易疲劳,改成亮色可能缓解。

更改前:

更改后:

【第一步】

进到个人目录:cd ~

执行:

dircolors -p > ~/.dircolors

说明:dircolors命令用于设置 ls 指令在显示目录或文件时所用的色彩。

-p或--print-database 显示预设置

> 重定向命令,此处意为将dircolors -p结果写入.dircolors文件中(覆盖写入;>>则表示追加写入)

【第二步】

打开.dircolors文件:

gvim~/.dircolors

搜索找到:

DIR 01;34

将34改为36,保存并退出

说明:

34意为blue,36意为cyan

颜色代码:

1 for brighter colors

4 for underlined text

5 for flashing text

30 for black foreground

31 for red foreground

32 for green foreground

33 for yellow (or brown) foreground

34 for blue foreground

35 for purple foreground

36 for cyan foreground

37 for white (or gray) foregroun

40 for black background

41 for red background

42 for green background

43 for yellow (or brown) background

44 for blue background

45 for purple background

46 for cyan background

47 for white (or gray) background

【第三步】

打开.cshrc文件:

gvim~/.cshrc

新增以下语句:

#ls colors

alias ls ls --color=auto

eval `dircolors -c ~/.dircolors`

说明

eval 命令用于重新运算求出参数的内容。

dircolors-c中

-c或--csh或--c-shell 显示在C shell中,将LS_COLORS设为目前预设置的shell指令。

保存并退出

【第四步】

source .cshrc

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。