Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > terminal output in color?

terminal output in color?
Thread Tools
Dedicated MacNNer
Join Date: Jun 2000
Status: Offline
Reply With Quote
Jan 16, 2005, 05:29 PM
 
i'm trying to get ls to output in color.

on a Linux box, i can type 'ls --color=tty'. however this doesn't seem to have any effect in the OSX (10.3) terminal.

thanks for any ideas,
ox
(Last edited by OmniX; Jan 16, 2005 at 05:35 PM. )
     
Mac Enthusiast
Join Date: Jan 2001
Location: Leesburg, Virginia
Status: Offline
Reply With Quote
Jan 16, 2005, 08:12 PM
 
How about:
Code:
ls -G
I found that the man page for ls has a bunch of things about color output in it.

Dominik Hoffmann
     
OmniX  (op)
Dedicated MacNNer
Join Date: Jun 2000
Status: Offline
Reply With Quote
Jan 16, 2005, 09:02 PM
 
Originally posted by DominikHoffmann:
How about:
Code:
ls -G
I found that the man page for ls has a bunch of things about color output in it.

Dominik Hoffmann
i've tried that, and unfortunately it doesn't seem to work!
     
Mac Enthusiast
Join Date: Jan 2001
Location: Leesburg, Virginia
Status: Offline
Reply With Quote
Jan 16, 2005, 09:55 PM
 
I've got this, when I do ls -laG:



Do you have something different?

Dominik Hoffmann
     
Professional Poster
Join Date: Jun 2000
Status: Offline
Reply With Quote
Jan 16, 2005, 09:57 PM
 
What version of 10.3 are you running? ls -G works for me running 10.3.7. Remember that UNIX is case sensitive (unlike DOS). Make sure you're using a capital G in the command or it won't work. In fact, using a lowercase g is an entirely different switch!
     
OmniX  (op)
Dedicated MacNNer
Join Date: Jun 2000
Status: Offline
Reply With Quote
Jan 16, 2005, 10:17 PM
 
Originally posted by bradoesch:
What version of 10.3 are you running? ls -G works for me running 10.3.7. Remember that UNIX is case sensitive (unlike DOS). Make sure you're using a capital G in the command or it won't work. In fact, using a lowercase g is an entirely different switch!
running 10.3.7. and i do invoke the proper switch: ls -G.
     
Mac Enthusiast
Join Date: Jan 2001
Location: Leesburg, Virginia
Status: Offline
Reply With Quote
Jan 16, 2005, 10:32 PM
 
Have you tried reinstalling your OS?
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Jan 16, 2005, 11:50 PM
 
Originally posted by OmniX:
i'm trying to get ls to output in color.

on a Linux box, i can type 'ls --color=tty'. however this doesn't seem to have any effect in the OSX (10.3) terminal.
You can do this on your Mac OS X box too, I've been doing it for several cat incarnations now (haha). You'll need to install the GNU ls, which is a part of the GNU coreutils package if you want pretty colors. I've always thought that ls -G had ugly colors, and besides, I'm used to the GNU ls's color scheme by now anyways.

"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Junior Member
Join Date: May 2004
Status: Offline
Reply With Quote
Jan 17, 2005, 12:06 PM
 
first make sure your $TERM is set to something like xterm-color. then make sure $CLICOLOR is set to 1. you dont have to install the GNU coreutils, although you certainly can if you want to. if you want to use the -G switch you dont need to set $CLICOLOR.
     
OmniX  (op)
Dedicated MacNNer
Join Date: Jun 2000
Status: Offline
Reply With Quote
Jan 17, 2005, 12:09 PM
 
Originally posted by leira:
first make sure your $TERM is set to something like xterm-color. then make sure $CLICOLOR is set to 1. you dont have to install the GNU coreutils, although you certainly can if you want to. if you want to use the -G switch you dont need to set $CLICOLOR.
thanks. can you be a bit more explicit in your instructions?
also, is there a reason why Apple doesn't configure the terminal like this by default?
     
Junior Member
Join Date: May 2004
Status: Offline
Reply With Quote
Jan 17, 2005, 02:43 PM
 
the way to set those variables is different for each shell.
first bash:
Code:
export TERM="xterm-color" export CLICOLOR=1
now tcsh:
Code:
set term="xterm-color" set clicolor=1
first just type those two commands into the terminal then try your ls.
if it works add those lines to a file called .profile in your home directory. easy way to do it is:
Code:
echo 'export TERM="xterm-color"' >> ~/.profile
i'm working from staight memory here so if that tcsh stuff is off a little please forgive me. if you using a different shell than the 2 above it shouldnt be hard to find out how to set the proper variables.
     
Fresh-Faced Recruit
Join Date: Dec 2004
Status: Offline
Reply With Quote
Jan 17, 2005, 10:14 PM
 
Originally posted by leira:
the way to set those variables is different for each shell.
...
[snip]
...
Or, you can set the Terminal type in "Terminal -> Preferences...".

Steve
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:07 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2