Since I have switched to Mac, I was wondering how to colorize the 'ls' output for it. I really like having color output when I use the ls command. This enables me to quick scan filetypes in a jiffy. In unix you can do this by giving '-color' option with ls but unfortunately that doesn't work with Mac. Apple has chnaged this option from '-color' to '-G'. So next time you want to see the colored ls output on your mac terminal, simple append below line in your .profile.

alias ls="ls -G"

You can also choose what color (foreground/background and bold/normal) you want for your specific file type. For this you need to set LSCOLORS variable as your choice. I use following LSCOLORS in my .profile:

export LSCOLORS=dxfxcxdxbxegedabagacad

You can craete your own LSCOLORS very easily here.


Subscribe - To get an automatic feed of all future posts subscribe here, or to receive them via email go here and enter your email address in the box. You can also like us on facebook and follow me on Twitter @akashag1001.