Stopping colored listings for ls
Published April 3rd, 2009Most of the time, I use putty for terminal sessions and the very first thing I end up doing is running unalias ls because I just cannot stand colored output from ls. I had been telling myself to do something about it for awhile but I never do as it is such a simple matter.
But finally, I got bugged enough that I decided to permanently remove the colored output from ls for me and the rest of the staff who have the same issue. Here is how:
- Login as root on your CentOS server
- Edit the
/etc/profile.d/colors.sh - Comment out the line:
alias ls='ls --color=tty' 2>/dev/null Change to: ## DISABLED alias ls='ls --color=tty' 2>/dev/null
- Now logout and log back in again and you should not see colors for
lsany more - Of course, if you do not want to logout this time, you can also run
source /etc/profile.d/colors.shto rerun this file, which gets run when you login and usebashshell.
Now from time to time if you have color cravings, you always execute ls --color=tty manually or create a temporary alias using alias ls='ls --color=tty' if you really, really need colors bad!
Cheers!
Kabir
Simon Green on April 6, 2009
Can I recommend, if you use PuTTY, rather than removing the hard to read colors just switch PuTTY to use System Colours?
Settings>Window>Colours>Use System Colours
This makes everything a lot easier to read, and actually makes the colours quite useful I find.