Search code examples
bashunixls

LS_COLORS key for network shared directories


I have mounted a network share with NFS and when I do ls --color it highlights the directories with green which is very hard to see. What LS_COLORS key do I have to change to change the highlight color? Also once this is done do I have to add something to my bashrc so that this takes effect on every login?


Solution

  • I'be finally figured this out and I needed to edit the OPEN_WRITABLE flag in the dircolors. To do this I followed these steps:

    1. execute the following from your home dir dircolors -p .dircolors
    2. then edit the file ~/.dircolors and update OPEN_WRITABLE with the desired colors
    3. edit ~/.bashrc and add the following

      # 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
      
    4. run source ~/.bashrc