color on the terminal

Z

zero17

Guest
now, on the terminal mac os x, I don't see colors which are distinguish folders, files, or execute file. different in linux, we are see blue for folders, green for execute files, red for tar files, and etc..

does anyone knows how to enable the colors on the terminal on mac os x, because it seems just has plain, without colors.

thank you all...
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
Put this in your .bashrc:


export CLICOLOR='true'
export LSCOLORS="gxfxcxdxbxegedabagacad"

if you want to change the colors, man ls for the settings of the LSCOLORS.
 
OP
Z

zero17

Guest
cradom said:
Put this in your .bashrc:


export CLICOLOR='true'
export LSCOLORS="gxfxcxdxbxegedabagacad"

if you want to change the colors, man ls for the settings of the LSCOLORS.

it doesn't work, but thanks for the reply. I don't know why it doesn't work.
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
What shell are you using? What version of OS X? Those commands were for bash under 10.3.9.
 
Joined
Mar 9, 2004
Messages
2,860
Reaction score
21
Points
38
Location
Miami FL
Your Mac's Specs
G4 1Ghz OS X 10.4.7
Open terminal. Under terminal menu, > Window settings > Click arrows where it says shell. Color is just past half way down
 
OP
Z

zero17

Guest
witeshark said:
Open terminal. Under terminal menu, > Window settings > Click arrows where it says shell. Color is just past half way down

is not that what I mean
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
Hmm..try setting it to xterm-color.

export TERM='xterm-color'
 
OP
Z

zero17

Guest
nope.. doesn't work, I've tried so many ways, but still, it doesn't work.. may be I didn't do it the right way. but thanks for your replies cradom..
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
Well, I'm out of ideas and since I'm still in Panther I cant test it. Sorry.
 
OP
A

aarle

Guest
One of the first answers
zero17 said:
export CLICOLOR='true'
was close.

You indeed have to set the environment CLICOLOR to true, but in the default tcsh you do this differently.

You could change the example environment file (this will enable color for ALL users): /usr/share/tcsh/examples/environment
and add to it this line: setenv CLICOLOR true
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
If he did a clean install of Tiger the default should be bash. If indeed he is using tcsh then my example wont work.
 
OP
M

mikeazorin

Guest
zero17, I take it that you are using /Applications/Utilities/Terminal and are not seeing different colors of files and folders while using the 'ls' command. This is the way the 'ls' command works in Mac OS X, and as I am aware there is no way to change it to distinguish filetypes with colors.
 
OP
Z

zero17

Guest
mikeazorin said:
zero17, I take it that you are using /Applications/Utilities/Terminal and are not seeing different colors of files and folders while using the 'ls' command. This is the way the 'ls' command works in Mac OS X, and as I am aware there is no way to change it to distinguish filetypes with colors.

I see, that sucks then.. thanks mikeazorin
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
mikeazorin said:
zero17, I take it that you are using /Applications/Utilities/Terminal and are not seeing different colors of files and folders while using the 'ls' command. This is the way the 'ls' command works in Mac OS X, and as I am aware there is no way to change it to distinguish filetypes with colors.

Not true. Man ls and look where it says Environment.
BTW: I got Tiger now and it works fine, although dark blue on black is hard to read. I need to change that :)
Are you using bash or tcsh?
Also, in preferences for Terminal, do you have Disable ANSI colors checked?
Uncheck it.
 
OP
Z

zero17

Guest
cradom said:
Not true. Man ls and look where it says Environment.
BTW: I got Tiger now and it works fine, although dark blue on black is hard to read. I need to change that :)
Are you using bash or tcsh?
Also, in preferences for Terminal, do you have Disable ANSI colors checked?
Uncheck it.

well if I use "ls man" it colors, but when I do "ls" it's not colors.

I couldn't find ANSI colors on terminal preferences...
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
My mistake, look under 'window settings - color', about halfway down, just under the color boxes.

If you type 'ls man' all you're going to get is "no such file or directory" unless you happen to be in /bin. 'man ls' will give a really long man page on the ls command.

Here is my .bashrc file. Copy whatever you want (the prompt stuff is custom and wont work without the other .bash_styles file), save it, quit terminal and re-start it. You "should" have different colors for your files.

Code:
# ~/.bashrc: executed by bash(1) for non-login shells.

export PS1='\u@\h:\w$ '
umask 022

##########################################
#setting up file completion
#

if [ -f ~/.bash_completion ];
then
        . ~/.bash_completion;
fi

##########################################
# advanced prompt settings
#

if [ -f ~/.bash_styles ];
then
        . ~/.bash_styles old;
fi

#export TERM='xterm-color'
#export NNTPSERVER='news.unina.it'
export EDITOR='pico'

PATH="/usr/local/bin:/usr/include:${PATH}"
export PATH

############################################
# You may uncomment the following lines if you want `ls' to be colorized:
#

 export CLICOLOR='true'
 export LSCOLORS="gxfxcxdxbxegedabagacad"
 
###########################################
# set up aliases
#
 
alias ll='ls -lagh'
alias l='ls -lagh'
alias grep='grep -n'
alias netconns='netstat -a -f inet'
alias cd..='cd ..'
alias ..='cd ..'
alias work='cd ~/working'
alias dl='cd /volumes/hd4/" downloads"'
alias d4='cd /volumes/hd4'
alias cls='clear'
# alias vi='vim'
# alias c++='g++'
# alias cc='gcc'
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'
alias ttop='top -ocpu -R -F -s 2 -n30'

############################################
# some aliases to set fancy prompts
# see .bash_prompt for further informations
#

if [ -f ~/.bash_styles ];
then
 alias dumb='. ~/.bash_styles dumb'
 alias ice='. ~/.bash_styles ice'
 alias fire='. ~/.bash_styles fire'
 alias nature='. ~/.bash_styles nature'
 alias sunshine='. ~/.bash_styles sunshine'
 alias dream='. ~/.bash_styles dream'
 alias magic='. ~/.bash_styles magic'
 alias testp='. ~/.bash_styles testp'
 alias old='. ~/.bash_styles old'
fi
source /sw/bin/init.sh

And of course the last line is for fink.
Good luck and let us know what happens.

PS:after you do this try typing 'env' and see if it says anything about clicolor anywhere.
 
OP
Z

zero17

Guest
I copy your .bashrc file, and I make sure that Disable ANSI colors is uncheck. I restart, and it didn't change, still doesnt has colors.

here is my env
Code:
TERM_PROGRAM=Apple_Terminal
TERM=xterm-color
SHELL=/bin/bash
TERM_PROGRAM_VERSION=133
USER=adit
__CF_USER_TEXT_ENCODING=0x1F5:0:0
PATH=/bin:/sbin:/usr/bin:/usr/sbin
PWD=/Users/adit
SHLVL=1
HOME=/Users/adit
LOGNAME=adit
SECURITYSESSIONID=69a600
_=/usr/bin/env

maybe you can tell with this where I should make changes?

thanks for your help.
 

rman


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
I believe that he is suggesting that you include this lines:

export CLICOLOR='true'
export LSCOLORS="gxfxcxdxbxegedabagacad"
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
It seems like bash isn't reading the .bashrc.
If you open your home folder in Finder can you see it? You shouldn't be able to. It's an invisible file. What are you using to edit it?

Also I think it needs to be executable. Rman, that right? mine is.

chmod +x .bashrc
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top