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意为blue36意为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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值