View previous topic :: View next topic |
Author |
Message |
tparker Tux's lil' helper
Joined: 03 Oct 2002 Posts: 85
|
Posted: Sat Dec 21, 2002 5:40 am Post subject: How to make console more colourful? |
|
|
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 |
|
|
st. anger Apprentice
Joined: 30 Oct 2002 Posts: 273
|
Posted: Sat Dec 21, 2002 6:13 am Post subject: |
|
|
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 |
|
|
theBlackDragon l33t
Joined: 23 Nov 2002 Posts: 768 Location: Belgium
|
Posted: Sat Dec 21, 2002 9:58 am Post subject: |
|
|
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 |
|
|
hook Veteran
Joined: 23 Oct 2002 Posts: 1398 Location: Ljubljana, Slovenia
|
Posted: Sat Jan 18, 2003 2:30 pm Post subject: |
|
|
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 |
|
|
zhenlin Veteran
Joined: 09 Nov 2002 Posts: 1361
|
Posted: Sun Jan 19, 2003 3:09 am Post subject: |
|
|
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 |
|
|
ronmon Veteran
Joined: 15 Apr 2002 Posts: 1043 Location: Key West, FL
|
Posted: Sun Jan 19, 2003 3:49 am Post subject: |
|
|
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 |
|
|
Ellidi Apprentice
Joined: 22 Oct 2002 Posts: 204 Location: iceland
|
Posted: Sun Jan 19, 2003 6:04 am Post subject: |
|
|
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 |
|
|
quag7 Apprentice
Joined: 12 Aug 2002 Posts: 288 Location: Marana, Arizona - USA
|
|
Back to top |
|
|
Chickpea l33t
Joined: 03 Jun 2002 Posts: 846 Location: Vancouver WA
|
Posted: Sun Jan 19, 2003 7:34 pm Post subject: |
|
|
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 |
|
|
bud1979 Tux's lil' helper
Joined: 11 Nov 2002 Posts: 122 Location: St. Louis
|
Posted: Sun Jan 19, 2003 11:18 pm Post subject: |
|
|
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 |
|
|
David_Escott l33t
Joined: 12 Jan 2003 Posts: 952 Location: Boston, MA
|
Posted: Sun Jan 19, 2003 11:32 pm Post subject: |
|
|
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 |
|
|
ronmon Veteran
Joined: 15 Apr 2002 Posts: 1043 Location: Key West, FL
|
Posted: Mon Jan 20, 2003 12:16 am Post subject: |
|
|
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 |
|
|
darktux Veteran
Joined: 16 Nov 2002 Posts: 1086 Location: Coimbra, Portugal
|
Posted: Mon Jan 20, 2003 12:53 am Post subject: |
|
|
Having colorgcc also puts some colors out when you do some emerging _________________ Lego my ego, and I'll lego your knowledge
www.tuxslare.org - My reborn website |
|
Back to top |
|
|
Chickpea l33t
Joined: 03 Jun 2002 Posts: 846 Location: Vancouver WA
|
Posted: Mon Jan 20, 2003 7:04 pm Post subject: |
|
|
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 |
|
|
hook Veteran
Joined: 23 Oct 2002 Posts: 1398 Location: Ljubljana, Slovenia
|
Posted: Tue Jan 21, 2003 11:09 am Post subject: |
|
|
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 |
|
|
David_Escott l33t
Joined: 12 Jan 2003 Posts: 952 Location: Boston, MA
|
Posted: Tue Jan 21, 2003 12:07 pm Post subject: |
|
|
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 |
|
|
proxy Apprentice
Joined: 20 Apr 2002 Posts: 260 Location: Chantilly, VA
|
Posted: Wed Jan 22, 2003 1:43 am Post subject: |
|
|
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 |
|
|
|