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?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
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.