Color ls outputMany 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.

ls, sysadmin, system administration, linux, shell, bash, sh, UNIX