mac(6) : 终端显示设置颜色

参考 : 

        http://blog.sina.com.cn//s/blog_a046022d0102v6fi.html

        https://github.com/EthsonLiu/personal-notes/blob/master/config/mac/mac_config.md#%E7%BB%88%E7%AB%AF

我的配置

配置说明 : 用户名(黄色),mac名称(绿色),文件夹(蓝色),可执行文件(绿色),字体不加粗(一般不设背景色,于是将所有2变成x)

1. 打开终端,用如下命令进入配置文件(需要输入密码),按i进入编辑模式

sudo vim ~/.bash_profile

2. 添加以下其中一种配置即可

#启用颜色
export LS_OPTIONS='--color=auto'
export CLICOLOR='Yes'
export LSCOLORS='exfxhxhxcxhxhxgxgxexex'
export GREP_OPTIONS='--color=auto'

export PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

 

#启用颜色
# Tell ls to be colourful
export CLICOLOR=1
export LSCOLORS=exfxhxhxcxhxhxgxgxexex
# Tell grep to highlight matches
export GREP_OPTIONS='--color=auto'
export TERM="xterm-color"
PS1='\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\]:\[\e[0;34m\]\w\[\e[0m\]\$ '

3. 按esc退出编辑模式, 输入 :wq 回车保存文件,并输入如下命令使配置文件生效

source ~/.bash_profile

4. 重启终端即可

自定义配置说明

颜色设置格式如下

export CLICOLOR=1
export LSCOLORS=1212121212121212121212

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 (透明)

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值