How to turn on or off colors in bash

by on November 4, 2006 · 1 comment· LAST UPDATED November 4, 2006

in

Q. How do I turn on or off file name colors in bash shell?

A. Most modern Linux distro comes with alias that defines colors for your file. However ls command is responsible for displaying color on screen for files, directories and other object.

By default, color is not used to distinguish types of files. You need to pass --color option to ls command.

Task: Turn off colors

Type the following command
$ ls --color=none
Or just remove alias with unalias command:
$ unalias ls

Task: Turn on colors

Use any of the following command:
$ ls --color=auto
$ ls --color=tty

You can add or remove ls alias from ~/.bash_profile or ~/.bashrc file.



If you would like to be kept up to date with our posts, you can follow us on Twitter, Facebook, Google+, or even by subscribing to our RSS Feed.


{ 1 comment… read it below or add one }

1 Philippe Petrinko April 2, 2010 at 8:24 am

Well may be the title would be better if it would mention [ ls ].
something like:
How to turn on or off colors _for ls command_ in bash

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

Tagged as:

Previous Faq:

Next Faq: