发布时间:2018-04-24作者:laosun阅读(2623)
让你的mac支持 ll 查询,并且设置文件夹和文件等颜色设置
sun:~ sun$ vim ~/.bash_profile #添加以下三行内容: alias ll='ls -lF' alias la='ls -A' alias l='ls -CF' sun:~ sun$ source ~/.bash_profile #重新加载一下
测试一下:
sun:~ sun$ ll total 8 drwx------ 7 sun staff 224 4 23 00:29 Applications/ drwx------@ 3 sun staff 96 4 23 00:29 Applications (Parallels)/ drwxr-xr-x 3 sun staff 96 3 25 15:05 Books/ drwx------+ 6 sun staff 192 4 9 10:54 Desktop/ drwx------+ 21 sun staff 672 4 24 20:30 Documents/ drwx------+ 19 sun staff 608 4 24 19:49 Downloads/ drwx------@ 82 sun staff 2624 3 28 15:23 Library/ drwx------+ 7 sun staff 224 4 4 09:56 Movies/ drwx------+ 10 sun staff 320 4 4 09:56 Music/ drwx------@ 7 sun staff 224 2 26 12:30 OneDrive/ drwx------ 9 sun staff 288 4 23 22:16 Parallels/ drwx------+ 23 sun staff 736 4 24 20:30 Pictures/ drwxr-xr-x+ 6 sun staff 192 1 20 2016 Public/ -rw-r--r-- 1 sun staff 57 4 7 09:58 dump.rdb drwxr-xr-x 4 sun staff 128 2 25 13:18 git/ -rw-r--r-- 1 sun staff 0 6 1 2017 x.pid
如果你想 ll 的时候就查询出隐藏文件,看下边:
alias ll='ls -lF' 修改成 alias ll='ls -alF'
颜色设置
#同样在bash_profile文件内,添加下边两行 export CLICOLOR=1 export LSCOLORS=exfxaxdxcxegedabagacad
CLICOLOR
是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。
LSCOLORS
是用来设置当CLICOLOR被启用后,各种文件类型的颜色。
LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。
LSCOLORS中一共11组颜色设置,共22个设置,按照先后顺序,先前景色,后背景色,
分别对以下的文件类型进行设置:
1.directory
2.symbolic link
3.socket
4.pipe
5.executable
6.block special
7.character special
8.executable with setuid bit set
9.executable with setgid bit set
10.directory writable to others, with sticky bit
11.directory writable to others, without sticky
LSCOLORS中,字母代表的颜色如下:
a 黑色
b 红色
c 绿色
d 棕色
e 蓝色
f 洋红色
g 青色
h 浅灰色
A 黑色粗体
B 红色粗体
C 绿色粗体
D 棕色粗体
E 蓝色粗体
F 洋红色粗体
G 青色粗体
H 浅灰色粗体
x 系统默认颜色
所以,如果我们想把目录显示成红色,就可以把LSCOLORS设置为bxfxaxdxcxegedabagacad就可以了
版权属于: 技术客
原文地址: https://www.sunjs.com/article/detail/882ced060f054854bbe9e273593767a7.html
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。