用了好久的mac,突然意识到不对劲,因为ls没有颜色,不能区分文件类型,这样问题来了,怎么修改颜色。ok,第一步先查看一下man ls结果找到了。一个叫LSCOLORS的环境变量设置,如下:

 LSCOLORS        The value of this variable describes what color to use for which attribute when colors are enabled
                 with CLICOLOR.  This string is a concatenation of pairs of the format fb, where f is the foreground
                 color and b is the background color.

                 The color designators are as follows:

                       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

                 Note that the above are standard ANSI colors.  The actual display may differ depending on the color
                 capabilities of the terminal in use.

                 The order of the attributes are as follows:

                       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


export LSCOLORS=gxfxaxdxcxegedabagacad

补充一下,有人说为啥设置了没有显示颜色,群里的一个兄弟碰到这个问题,这是因为CLICOLOR 没有开起来,所以要这是一下:

export CLICOLOR=1


  1. 嘎嘎,没用过zsh,不知道好用不。
    1. 嘎嘎,没用过zsh,不知道好用不。
      1. 好高级
          1. 呵呵
            1. 楼上的笑而不语。
        1. 刀子最近在干嘛?