When I run
ls on a folder with directories that have a 777 permission, the
ls colors are purple text with a green background, which is unreadable:
What can I do to make this more pleasant to look at?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
If you are using Linux (and not, e.g., using a Mac which does things differently) you can use
dircolors with a custom database to specify which colors are used for which file attributes.
First, create a dircolors database file.
$ dircolors -p > ~/.dircolors
Then edit it, you probably want to change the
OTHER_WRITABLE lines to something more pleasant than
34;42 (34 is blue, 42 is green -
dircolors -p helpfully includes comments with the color codes listed).
eval $(dircolors ~/.dircolors)
Edit your ~/.profile (or ~/.bash_profile etc) and find the line that runs
eval $(dircolors) and change it to include the filename as above. Or if there isn't such a line in your .profile (etc) add it.
Or, if you want it to work whether there is a
~/.dircolors file or not, change it to:
[ -e ~/.dircolors ] && eval $(dircolors -b ~/.dircolors) || eval $(dircolors -b)
As a stopgap solution, you can use
ls --color=never. (Works on CentOS, not sure about
ls options on Cygwin; check
man ls if it doesn't work.)
alias, and if you see
alias ls='ls --color=auto', you can run
unalias ls to turn off automatic coloring of
ls output. More permanent solutions (i.e. actually changing those colors instead of removing them) involve changing the colorization options for your terminal, but I'll leave that answering job for someone who actually knows how to do it....