Saw directory listing coloring at Golden Ruby Users Group this week, and needed to have it!

LS_COLORS='di=1:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.rpm=90'
export LS_COLORS

Customize Your Colors

The values in LSCOLORS are codes corresponding to different colors for different types of files. The letter you use indicates which color to use, and the position in the string indicates what type of file should be that color. Each color comes in pairs – a foreground color and a background color. Here is a list of color values:

  • a = black

  • b = red

  • c = green

  • d = brown

  • e = blue

  • f = magenta

  • g = cyan

  • h = grey

  • A = dark grey

  • B = bold red

  • C = bold green

  • D = yellow

  • E = bold blue

  • F = magenta

  • G = cyan

  • H = white

  • x = default

And here is a list of the positions in LSCOLORS:

  • directory

  • symbolic link

  • socket

  • pipe

  • executable

  • block device

  • character device

  • executable with setuid set

  • executable with setguid set

  • directory writable by others, with sticky bit

  • directory writable by others, without sticky bit

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

About the Author

Paul is a software design and development coach and mentor. He is available for consulting and training through his company, Virtual Genius LLC. He is the author of The EventStorming Handbook and major contributor to Behavior-Driven Development with Cucumber. He is also the founder and chair for the Explore DDD conference.