Colorize Mac ls output

Being an avid user of unices, I really like having color output when I use the ls command. In the past I have gone through a detailed process of getting GNU fileutils and building my own ls from that, and putting that version of ls in my path. Lots of hogwash, right? I just found out that for whatever reason, the dudes at Apple decided to change the color flag for their ls from "color" to "G". So that's, it. To enable color output of ls on Mac, just add an alias to your shel profile of:

alias ls="ls -G"

Now,enjoy colored ls output. However, since I use a black background on my terminal, the blue is hard to read so I also ad this to my profile as well:

export LSCOLORS=dxfxcxdxbxegedabagacad

I don't know what it all means but the colors it makes work for me.

Comments:

And I like iTerm as a terminal ...

Posted by Terry Gardner on June 14, 2007 at 06:27 AM PDT #

Thanks for the suggestion. iTerm is pretty nice, I still use the color setup that wrote about, but now use it as my terminal client. One thing I really like about iTerm is that "exit" command quits, and of course tabs are much loved as well.

Posted by Tony Beckham on June 20, 2007 at 01:37 AM PDT #

Howdy,
It isn't that Apple decided to change the flag to G, but rather OS X comes with the BSD version of ls which uses G as the color flag, whereas the GNU version of ls uses "--color."
Cheers

Posted by sam on October 11, 2007 at 03:44 AM PDT #

PDA MOBILECOMMUNICATION INC

We are Recognized Distributer of Various Consumer Electronics. We Specialize in a wide Range of Products such as Mobile Phones,Video Games, Laptops, Dj Equipments, Ipods, Xboxs and many more.

Number of employees (total in the company)From 251 to 500
Date established 2001
Legal Form Private Limited Company
Incorporation Date: 09-03-1993
Registered No.02797476

Reply To:roselinecellcomm2015@inbox.lv
Reply To:roselinecellcomm@inbox.lv

For more information Regarding our product, Kindly Contact us at roselinecellcomm@inbox.lv , We look forward in receiving your Order also to give you the most competent services as we are Using this Medium to Look For Buyers Of Various Electronics Product.

PRODUCT LIST:

TOM TOM GO 500............ $150 USD
TOM TOM GO 510............ $160 USD
TOM TOM GO 700............ $190 USD
TOM TOM GO 300............ $140 USD
TOM TOM RIDER..............$190 USD
TOM TOM GO 910............ $200 USD

SIDEKICK:
SIDEKICK LRG 3--$170
SIDEKICK 3----- $130
SIDEKICK 2----- $110
JUICY COUTURE SIDEKICK I----- $100
SIDEKICK II MISTER CARTOON--$130
JUICY COUTURE SIDEKICK II----- $130

PLASTATIONS:
GARMIN 660........$200
GARMIN 396........$130
Playstation 1.....$110
Playstation 2.....$120
Playstation 3.....$250
Sony PSP Value Pack--$100
Nintendo Wii --- $155

XBOX GAMES:
Xbox 360 Core System ----- $150
Xbox 360 Prenium pack --$180
Xbox 360 Platinum Bundle Console ----- $145

Apple iPod 30GB (Video) New! ===$100.95
Apple iPod 60GB (Video) New! ===$130.00
Apple iPod Nano 2GB New!========$75.00
Apple iPod Nano 4GB New!========$100.50
Apple iPod Shuffle 512MB =======$55.75
Apple iPod Shuffle 1GB =========$50.00
Apple iPod Mini 4GB ============$75.55
Apple iPod Mini 6GB ============$90.50
Apple iPod Photo 30GB ==========$100.00
Apple iPod U2 SE 30GB===========$105.95
Apple iPod Photo 60GB ==========$125.50
Apple iPod 20 GB================$90.00

Dopod 838 Pro ( 838pro )========$300

Apple iphone 4GB=====$250
Apple iphone 8GB=====$350

HTC X7500 $400
HTC S710 $280
HTC P350 $280
HTC P3400 $230
HTC P4350 $180
HTC P3600 $200
HTC P3300 $140
HTC S620 $160
HTC S310 $170
HTC TYTN $300
HTC MT EOR $180

NEXTEL:
NEXTEL i60c ........$50
NEXTEL i90c ........$95
NEXTEL i95cl........$130
NEXTEL i30sx........$55
NEXTEL i88s ........$70
NEXTEL i35s ........$30
NEXTEL i58sr........$75
NEXTEL i2000........$60
NEXTEL i830 ........$120
NEXTEL i860 ........$130
NEXTEL i930 ........$110
NEXTEL i860 ........$100
NEXTEL 1930 ........$120
NEXTEL i870 ........$140
NEXTEL i450 ........$90
NEXTEL 1860 ........$110

Nokia 8600 Luna====$300
Nokia E90===$250
Nokia N73===$150
Nokia N75===$170
Nokia N80===$180
Nokia N90===$180
Nokia N91===$180
Nokia N92===$200
Nokia N93===$200
Nokia N93i===$230
Nokia N95===$250
Nokia N95 8GB==$300
Nokia N-Gage===$175
Nokia N-Gage QD===$150
Nokia 8800 sirocco==$250

Black Berry 8820 ..............$220
Black Berry 8800 ..............$200
Black Berry Pearl 8100 ........$170
Black berry 7130g .............$220
Black berry 7130c .............$140
Black berry 7130v .............$120
Black berry 8707V .............$270
Black berry 8700c .............$240
Black berry 7100x .............$180
Black berry 7100t .............$160
Black berry 7100v .............$220
Black berry 7290\* .............$220
Black berry 7730 ..............$240
Black Berry 7510...............$270

I-MATE K-JAM.........................$200USD
i-MATE JASJAR........................$220USD

Qtek 9600.............................$220usd
Qtek 8310.............................$150usd
Qtek 9100.............................$200usd
Qtek 8020.............................$170usd
\*
Palm Treo 755p............................$250USD
Palm Treo 750.............................$200USD
Palm Treo 700w............................$180USD
Palm Treo 650.............................$140USD
Palm Treo 700p............................$180USD

We Offer Brand New Products With Complete Accesories and Product Comes with 1 Full Year International Warranty From Manufacturer, Products will be delivered to your Door Step via Fedex courier service.

kindly get back to us with your order details and your contact phone number so we can proceed with your order.

Reply To:roselinecellcomm2015@inbox.lv
Reply To:roselinecellcomm@inbox.lv

Regards.

Posted by roselinephones on January 21, 2008 at 06:05 AM PST #

You are great - I was looking for exactly this. Many thanks stranger.

Posted by aditya Pandey on March 06, 2008 at 05:40 PM PST #

Thanks for this, I was always wondering how to display color data in terminal, but too lazy to find the answer in the help :-D

Posted by Nate on February 01, 2009 at 01:02 PM PST #

if you capitalise the letters it will be in bold.
I use it in that way. for example :
export LSCOLORS=Dxfxcxdxbxegedabagacad

:)

Posted by loi scellier on August 12, 2009 at 06:14 AM PDT #

Seems like export CLICOLOR=1 in your .bashrc or .bash_profile is easier than aliasing ls.

Posted by Martin Smith on October 08, 2010 at 07:24 AM PDT #

Many thanks for the tip! This did exactly what you said, the only thing that perhaps people should know is that the file to add these to is ~/.profile

Posted by Sam on January 08, 2011 at 03:33 PM PST #

As there are variances from system to system, I posted a little more thorough example below. One of the important additions for some iTerms is the:

export TERM=xterm-color

I didn't have to create the alias on mine.

Here's the example code:

#enables color in the terminal bash shell export

CLICOLOR=1

#sets up the color scheme for list export

LSCOLORS=gxfxcxdxbxegedabagacad

#sets up the prompt color (currently a green similar to linux terminal)

export PS1='\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;36m\\]\\w\\[\\033[00m\\]\\$ '

#enables color for iTerm

export TERM=xterm-color

#sets up proper alias commands when called

alias ls='ls -G'

(taken from http://blog.imzaid.com/color-terminal-bash-on-the-mac-iterm-included. Link also includes info on how to customize your ls color output):

Posted by Allasso on February 10, 2011 at 12:29 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

I am a tech geek and have a passion for technology. Currently I work in the software division of Sun Microsystems supporting XML tooling, and Python support in the NetBeans IDE.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Bookmarks