首页 > 系统 > Mac OS > 正文

MacBook设置终端命令行的颜色高亮显示

2024-06-28 13:22:50
字体:
来源:转载
供稿:网友
MacBook设置终端命令行的颜色高亮显示

一、颜色高亮显示

针对terminal采用bash模式:

  1. 编辑 ~/.bash_PRofile, 加入以下代码:
    export CLICOLOR=1export LSCOLORS=gxfxaxdxcxegedabagacad
  2. 保存,然后重启terminal,搞定,恢复正常了.

详细讲解代码中的涵义:

  1. CLICOLOR: 前景色和背景色的字符串合并值
  2. LSCOLORS: 对于不同变量所采用的颜色方案,具体看如下表格:a blackb redc greend browne bluef magentag cyanh light greyA bold black, usually shows up as dark greyB bold redC bold greenD bold brown, usually shows up as yellowE bold blueF bold magentaG bold cyanH bold light grey; looks like bright whitex default foreground or background而文件类型列表如下:1. directory2. symbolic link3. socket4. pipe5. executable6. block special7. character special8. executable with setuid bit set9. executable with setgid bit set10. directory writable to others, with sticky bit11. directory writable to others, without sticky

所以对照这张表就可以得知:

gxfxaxdxcxegedabagacad

就是对于directory而言,它的前景色就是: g(cyan),而背景色就是:x(默认的背景色).


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表