Home > programming > OS X terminal colors!

OS X terminal colors!


http://www.geekology.co.za/blog/2009/04/enabling-bash-terminal-directory-file-color-highlighting-mac-os-x/

 

 

Enabling directory and file color highlighting requires that you open (or create) ~/.bash_profile in your favourite text editor, add these contents:

 

export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad

… save the file and open a new Terminal window (shell session). Any variant of the “ls” command:

ls
ls -l
ls -la
ls -lah

… will then display its output in color.

More details on the LSCOLORS variable can be found by looking at the man page for “ls“:

man ls

LSCOLORS needs 11 sets of letters indicating foreground and background colors:

  1. directory
  2. symbolic link
  3. socket
  4. pipe
  5. executable
  6. block special
  7. character special
  8. executable with setuid bit set
  9. executable with setgid bit set
  10. directory writable to others, with sticky bit
  11. directory writable to others, without sticky bit

The possible letters to use are:

a  black
b  red
c  green
d  brown
e  blue
f  magenta
c  cyan
h  light grey
A  block black, usually shows up as dark grey
B  bold red
C  bold green
D  bold brown, usually shows up as yellow
E  bold blue
F  bold magenta
G  bold cyan
H  bold light grey; looks like bright white
x  default foreground or background

By referencing these values, the LSCOLORS variable setting mentioned above translates to:

Bold blue with default background for directories, bold magenta with default background for symbolic links, bold green with default background for sockets, etc.

Advertisements
Categories: programming
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: