Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to make console more colourful?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
tparker
Tux's lil' helper
Tux's lil' helper


Joined: 03 Oct 2002
Posts: 85

PostPosted: Sat Dec 21, 2002 5:40 am    Post subject: How to make console more colourful? Reply with quote

I've migrated to Gentoo from RedHat - and one of the differences (albeit not important) in the default setup is that of the console. In RedHat, everything is nicely colour coded (for example in ls). In Gentoo, it's all grey by default (apart from the prompt itself).

How do I go about replicating the Red Hat feel as far 'ls' is concerned?

Thanks!

Terence.
Back to top
View user's profile Send private message
st. anger
Apprentice
Apprentice


Joined: 30 Oct 2002
Posts: 273

PostPosted: Sat Dec 21, 2002 6:13 am    Post subject: Reply with quote

Code:
ls --color


you can add an alias to your ~/.profile :
Code:
alias ls='ls --color'

also do "man ls" for more info and check out /etc/DIR_COLORS or ~/.dir_colors to customize the color output.
Back to top
View user's profile Send private message
theBlackDragon
l33t
l33t


Joined: 23 Nov 2002
Posts: 768
Location: Belgium

PostPosted: Sat Dec 21, 2002 9:58 am    Post subject: Reply with quote

Linux Journal had a cool aritcle about BASH a couple of years ago, which I still use as a base to tweak my BASH-setup.
You can find it here .
Back to top
View user's profile Send private message
hook
Veteran
Veteran


Joined: 23 Oct 2002
Posts: 1398
Location: Ljubljana, Slovenia

PostPosted: Sat Jan 18, 2003 2:30 pm    Post subject: Reply with quote

hmmmm ...i get blue dirs and green executables ...but that's about it ...my DIR_COLORS is ok (enabled picture, movie, compressed etc colors) ...but i don't get it out at the console (ot *term)
_________________
tea+free software+law=hook

(deep inside i'm still a tux's little helper)
Back to top
View user's profile Send private message
zhenlin
Veteran
Veteran


Joined: 09 Nov 2002
Posts: 1361

PostPosted: Sun Jan 19, 2003 3:09 am    Post subject: Reply with quote

ls --color=tty will force colour. Note that this will ruin most ls dependant scripts.
ls --color=auto will check if output is being redirected. If not, it will show colour.
Back to top
View user's profile Send private message
ronmon
Veteran
Veteran


Joined: 15 Apr 2002
Posts: 1043
Location: Key West, FL

PostPosted: Sun Jan 19, 2003 3:49 am    Post subject: Reply with quote

Here are a few lines from my ~/.bashrc that brighten things up a bit. The special .tgz color is left over from my Slackware days :)

Code:

alias ls='ls --color'
LS_COLORS='di=37:fi=0:ln=35;1:or=31;104:mi=31;104:ex=91:*.tgz=93:*.tar.gz=32;1:*.tar.bz2=32;1'
export LS_COLORS


And this a two-color, two-line prompt that I like (it includes a time hack at the beginning):

Code:

PS1="\[\033[1;36m\]\$(date +%H%M) \u\033[0m\]\033[0;36m\]@\h \w\n>\[\033[0m\] "
Back to top
View user's profile Send private message
Ellidi
Apprentice
Apprentice


Joined: 22 Oct 2002
Posts: 204
Location: iceland

PostPosted: Sun Jan 19, 2003 6:04 am    Post subject: Reply with quote

ronmon wrote:

Code:

PS1="\[\033[1;36m\]\$(date +%H%M) \u\033[0m\]\033[0;36m\]@\h \w\n>\[\033[0m\] "


You don't find it annoying, not having a doubledash between the %H and %M ?
.. or did you just go through a strict millitary training ? :P
_________________
What if God smoked cannabis...
What do you mean with 'What if' ?
Back to top
View user's profile Send private message
quag7
Apprentice
Apprentice


Joined: 12 Aug 2002
Posts: 288
Location: Marana, Arizona - USA

PostPosted: Sun Jan 19, 2003 11:46 am    Post subject: Reply with quote

On a related note, if you're looking at customizing or adding color to your prompt, I've been using this article for awhile, written by someone you might recognize:

http://www-106.ibm.com/developerworks/linux/library/l-tip-prompt/

I've been reffing this article since long before I ever heard of Gentoo.
_________________
http://www.dataswamp.net
Back to top
View user's profile Send private message
Chickpea
l33t
l33t


Joined: 03 Jun 2002
Posts: 846
Location: Vancouver WA

PostPosted: Sun Jan 19, 2003 7:34 pm    Post subject: Reply with quote

I have found that only the root console output is not in color but all users output is in color. It seems that no matter what I put in the profile or bashrc seems to take hold unless I su to root.
Back to top
View user's profile Send private message
bud1979
Tux's lil' helper
Tux's lil' helper


Joined: 11 Nov 2002
Posts: 122
Location: St. Louis

PostPosted: Sun Jan 19, 2003 11:18 pm    Post subject: Reply with quote

hey Ronmon,

do you have a list of all the items you put in your list like di or fi? Just wondering if they have a list somewhere. Thanks.
Back to top
View user's profile Send private message
David_Escott
l33t
l33t


Joined: 12 Jan 2003
Posts: 952
Location: Boston, MA

PostPosted: Sun Jan 19, 2003 11:32 pm    Post subject: Reply with quote

chickpea are you putting these in /etc/profile or are you putting them in .profile because /etc/profile is for the whole system whereas .profile is just for that user so when you su to root you would expect the colors to disappear
Back to top
View user's profile Send private message
ronmon
Veteran
Veteran


Joined: 15 Apr 2002
Posts: 1043
Location: Key West, FL

PostPosted: Mon Jan 20, 2003 12:16 am    Post subject: Reply with quote

Quote:

.. or did you just go through a strict millitary training ? :P


Well, I entered military school in sixth grade, got out and joined the Air Force, now do marine surveys for a living. I guess the 24 hour clock is pretty heavily embedded after more than thirty years. :D It looks something like this:


1916 ronmon@mimi ~
>


The old link I had on ls colors was dead, but I found it on a new site here (thanks, Google!). It has a pretty good list of the file types and color codes.

And here's a good link for bash prompts.
Back to top
View user's profile Send private message
darktux
Veteran
Veteran


Joined: 16 Nov 2002
Posts: 1086
Location: Coimbra, Portugal

PostPosted: Mon Jan 20, 2003 12:53 am    Post subject: Reply with quote

Having colorgcc also puts some colors out when you do some emerging :wink:
_________________
Lego my ego, and I'll lego your knowledge

www.tuxslare.org - My reborn website :P
Back to top
View user's profile Send private message
Chickpea
l33t
l33t


Joined: 03 Jun 2002
Posts: 846
Location: Vancouver WA

PostPosted: Mon Jan 20, 2003 7:04 pm    Post subject: Reply with quote

Quote:
chickpea are you putting these in /etc/profile or are you putting them in .profile because /etc/profile is for the whole system whereas .profile is just for that user so when you su to root you would expect the colors to disappear


Actually, after looking at my system again, I dont have a .profile in any home directory and I dont have colors liste in the /etc/profile either....I think it actually points to /etc/profile.env.

I have the color listing in the .bashrc. It is not that important I guess....just something I noticed. Maybe I should fix it.

Cat
Back to top
View user's profile Send private message
hook
Veteran
Veteran


Joined: 23 Oct 2002
Posts: 1398
Location: Ljubljana, Slovenia

PostPosted: Tue Jan 21, 2003 11:09 am    Post subject: Reply with quote

question: so WTF is /etc/DIR_COLORS doing then, if not what it is suposed to? ...i mean, does it only sit there and fill up the space?!? ...my /etc/DIR_COLORS is correct, but i can't find where to put it in :(
_________________
tea+free software+law=hook

(deep inside i'm still a tux's little helper)
Back to top
View user's profile Send private message
David_Escott
l33t
l33t


Joined: 12 Jan 2003
Posts: 952
Location: Boston, MA

PostPosted: Tue Jan 21, 2003 12:07 pm    Post subject: Reply with quote

have your tried
export LS_COLORS=`dircolors`--scratch that

just
`dircolors` --nope

but just look at the output of
dircolors and you will see what you need to do

next time i should just read the man page

Typical Usage:
eval `dircolors [OPTION]... [FILE]`
Back to top
View user's profile Send private message
proxy
Apprentice
Apprentice


Joined: 20 Apr 2002
Posts: 260
Location: Chantilly, VA

PostPosted: Wed Jan 22, 2003 1:43 am    Post subject: Reply with quote

best way to do it:

Code:
cp /etc/skel/.bash* ~


(if you have created or edited .bashrc or .bash_profile, you shoudl back them up)

proxy
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum