Get rid of color ‘ls’ output in Linux
Categories: Database Administration, Information Technology, System Administration, UNIX
Many popular varieties of Linux use a “feature” which causes the ls command output to show files, directories, links, etc. all in different colors. I guess some people prefer this, but I find it at best annoying, and at worst illegible. Specifically the color-coding of symbolic links tend to show in such a light color that it is often impossible to read.
The color output is accomplished by adding the --color=tty or a similar option to the ls command. This is typically accomplished by creating an alias to ls in either the user’s profile or in one of the system-wide profiles.
alias ls='ls --color=tty'
My personal preference is to remove this line from any system-wide configuration files (such as /etc/profile) and allow users to set it in their own profile if preferred. If you don’t have the desire or ability to make this change universally than a user can easily disable the color output by using the unalias command:
unalias ls
This can either be added to the user’s configuration file (e.g. the .profile or .bash_profile in their home directory), or you can just type unalias ls anytime to disable color ls output for the rest of the current shell session. This can be especially useful to turn off the color output when you’re working on someone else’s system.
Color-coded ls output can cause permissions errors in some circumstances, so in my opinion it is best left off, but if you’re stuck with it then it’s nice to know how it can be disabled when necessary.


November 12th, 2007 at 11:40 pm
Can you describe what you mean when you say “Color-coded ls output can cause permissions errors in some circumstances”? In what way would the output of ls cause permissions problems?
November 14th, 2007 at 4:17 am
I was wondering exactly the same as Cloned Milkmen. During my 11 years of using Linux I have never come across such an issue.
November 15th, 2007 at 4:09 pm
I have posted a response to your question:
Color ls output and Permission denied
Thanks for asking. I was hoping someone would.
November 24th, 2007 at 3:15 am
In CentOS, if you copy the file /etc/DIR_COLORS to your home directory as ~/.dir_colors, and if you change the line with “COLOR tty” to “COLOR none”, then all your login sessions become color-free.
Was looking for a solution to this color mess. I can’t bear bright colors due to eye problems. Hence, the desperate need to de-colorify the terminal o/p.
February 21st, 2008 at 8:36 pm
Why do you guys hate colors so much?
Colors are what makes life vibrant.
July 9th, 2008 at 7:03 pm
I execute “unalias ls” in my profile. ls is aliased to “ls –color=tty”. That takes care of the color issue.
The reason why I don’t use the color is that I have problems with my vision and need high contrast like white on black. So, on a color listing, I can’t see the dark blue against a black background.
Jack
July 28th, 2008 at 1:34 pm
Color is great but not in plain terminal environments. We use a terminal emulator that defaults to blue backgrounds and the Linux color “ls” ends up setting the default text color to blue– so we get blue on blue and can’t read anything. Color “ls” makes bogus assumptions about what kind of terminal you are using and how it is configured, and is generally distracting. And don’t get me started on the color “vim” enhancements– they set new standards of annoyance, especially since figuring out all the settings you have to turn off can be quite a challenge:
syntax off
let g:loaded_matchparen=1
set nocp
set noincsearch
set nohlsearch
set noshowmatch
August 9th, 2008 at 3:22 pm
Thank you. I just installed Ubuntu 8.04.1 and it was extremely annoying. Defaulted to light pastels on a white background, and worse, for some directories it was dark green text on a slightly darker green background making it literally illegible. If the defaults were sane colors I could have lived with them, but I have better things to do with my time than editing color codes for ls.