Mac OSX设置ls颜色的方法

Mac OSX的ls是没有颜色的,下面是设置ls颜色的方法。

1、打开~目录下的.bash_profile(没有此文件的话新建一个,注意前景有.,是隐藏文件):

vim .bash_profile

2、在.bash_profile里添加下面两个语句:

export CLICOLOR=1

export LSCOLORS=1212121212121212121212

3、LSCOLORS的具体设置看下面:

LSCOLORS的1对应前景色,2对应背景色。

实际应用中,将1和2改成下面的字母——对应不同颜色。

LSCOLORS共有11组”12”设置,每组12对应文件类型为

1. directory

2. symbolic link

3. socket

4. pipe

5. executable (可执行文件,x权限)

6. block special

7. character special

8. executable with setuid bit set (setuid=Set User ID,属主身份)

9. executable without setgid bit set

10.directory writable to others, with sticky bit

11.directory writable to others, without sticky bit

字母代表的颜色如下:

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 grey; looks like bright white

x  default foreground or background (透明)

我一般不设背景色,于是将所有2变成x。

文件夹颜色一般设为红色,可执行文件一般设为青色(或绿色)。

最后,我用的颜色设置为:

export LSCOLORS=bxfxhxhxgxhxhxgxgxbxbx 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值