HowTo Turn On or Off Colors For ls Command In Bash On a Linux and Unix-like Systems

by on November 4, 2006 · 1 comment· LAST UPDATED March 14, 2014

in , ,

How do I turn on or off file name colors (ls command colors) in bash shell on a Linux or Unix like operating systems?

Most modern Linux distributions and Unix systems comes with alias that defines colors for your file. However, ls command is responsible for displaying color on screen for files, directories and other file system objects.

Tutorial details
DifficultyEasy (rss)
Root privilegesNo
Estimated completion timeN/A
By default, color is not used to distinguish types of files. You need to pass --color option to the ls command on Linux. If you are using OS X or BSD based system pass -G option to the ls command. The syntax is as follows to turn on or off colors.

Task: Turn off colors for ls command

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

Task: Turn on colors for ls command

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

A note about *BSD/OS X ls command

Pass the -G option to ls command to enable colorized output on a {Free,Net,Open}BSD or Apple OS X:
$ ls -G

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

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 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


Leave a Comment

Tagged as: , ,

Previous Faq:

Next Faq: