LS_COLORS用于网络共享目录的密钥

时间:2011-12-10 14:31:12

标签: bash unix ls

我已经使用NFS安装了网络共享,当我ls --color时,它会突出显示绿色的目录,这很难看到。我必须更改什么LS_COLORS键才能更改高亮颜色?一旦完成这个,我是否必须在我的bashrc中添加一些内容,以便每次登录都生效?

3 个答案:

答案 0 :(得分:0)

这是获取当前LS_COLORS的命令

dircolors --print-database

如果没有错,则将NFS视为BD(块设备驱动程序)

如果要为每次登录覆盖网络驱动器的现有绿色,请执行以下操作 在.bashrc

中声明类似下面的内容
LS_COLORS="bd=xx;yy" <-- color can refer back dircolors --print-database
export LS_COLORS

答案 1 :(得分:0)

我终于想通了,我需要在dircolors中编辑OPEN_WRITABLE标志。为此,我按照以下步骤操作:

  1. 从您的主目录dircolors -p .dircolors
  2. 执行以下操作
  3. 然后编辑文件〜/ .dircolors并使用所需的颜色更新OPEN_WRITABLE
  4. 编辑〜/ .bashrc并添加以下内容

    # enable color support of ls and also add handy aliases
    if [ -x /usr/bin/dircolors ]; then
        test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
        [ -e "$HOME/.dircolors" ] && DIR_COLORS="$HOME/.dircolors"
        [ -e "$DIR_COLORS" ] || DIR_COLORS=""
            eval "`dircolors -b $DIR_COLORS`"
            alias ls='ls --color=auto' 
            alias grep='grep --color=auto'
            alias fgrep='fgrep --color=auto'
            alias egrep='egrep --color=auto'
    fi
    
  5. 运行source ~/.bashrc

答案 2 :(得分:0)

我通过改变&#39; tw&#39;的值来解决这个问题。 STICKY_OTHER_WRITABLE和&#39; ow&#39;在env var LS_COLORS中的OTHER_WRITABLE。

查看Configuring LS_COLORS

:tw=00;34:ow=00;34: