CA BD NY
  • Categories

  • Recent Posts

  • RSS MySQL Hacker

  • RSS Apache Hacker

  • RSS MiniCTO

  • Meta

  • Stopping colored listings for ls

    Published April 3rd, 2009

    Most 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:

    1. Login as root on your CentOS server
    2. Edit the /etc/profile.d/colors.sh
    3. Comment out the line:
      alias ls='ls --color=tty' 2>/dev/null
      
      Change to:
      ## DISABLED alias ls='ls --color=tty' 2>/dev/null
      
    4. Now logout and log back in again and you should not see colors for ls any more
    5. Of course, if you do not want to logout this time, you can also run source /etc/profile.d/colors.sh to rerun this file, which gets run when you login and use bash shell.

    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

    Get a Trackback link

    1 Comments

    1. 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.

    Leave a comment

    Comment Policy: First time comments are moderated. Please be patient.