I would like to know how to change the terminal color, so whenever I run
ls it will return the name of:
- Directories in red
- Files in blue
- Executable files (those you do
./file) in light green
How do I do that?
Usually this is done with
Personally I'm using an alias, e.g. in
.bash_aliases which is loaded by
alias ls="ls -G"
However, there's another option, i.e. turning on
CLICOLOR in your shell, e.g. by adding the following to your
See this article "ls, colors, and Terminal.app" to customize the default
Basically, what you need to do is change the value of the
LSCOLORS variable (default is
Gxfxcxdxbxegedabagacad on OS X). Each letter represent a color:
And each two-letter group the foreground and background color for a type of entry.
For example, the first two letters make your directories being shown as Cyan (
G) on a default (
x) background (ie. the background color of your term).
The positions are:
So to get the output you asked in your question, setting
bxfxcxdxcxegedabagacad should do the trick, except for the "normal files" colors, which it seems can't be changed this way.
All credits to Jonathan Dance for the blog post linked earlier, most of this answer is copied from it.