LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-05-2007, 08:48 PM   #1
lectraplayer
Member
 
Registered: Mar 2003
Location: a little west of Birmingham, AL, USA.
Distribution: Porteus 3.1
Posts: 932

Rep: Reputation: 32
Configuring terminal colors (the original BASH shell!)


I remember being able to configure the colors of my BASH terminal (outside of X), but am trying to remember how I did it. Seems like it was something like set term -background white -foreground red as one example, and with the same command stopping the screen from blanking with something like set term -blank 0 or something to that effect. Now, for the life of me, I seem to be having difficulty pulling it off. I dug up where someone mentioned that it was setterm -blank 0, but that proved to be incorrect. The man pages I've stumbled across are getting me no closer. What was the command again? I like to beat commands into Linux outside of X occasionally. Some things are actually easier and work better away from X.
 
Old 09-05-2007, 08:51 PM   #2
SlowCoder
Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Fedora (Desktop), CentOS (Server), Knoppix (Diags)
Posts: 934

Rep: Reputation: 38
Here's a little script I wrote not too long ago. Add it to your .bashrc

Code:
#Color Codes: 
#Black      0;30    Dark Gray    1;30 
#Red        0;31    Light Red    1;31 
#Green      0;32    Light Green  1;32 
#Brown      0;33    Yellow        1;33 
#Blue        0;34    Light Blue    1;34 
#Purple      0;35    Light Purple  1;35 
#Cyan        0;36    Light Cyan    1;36 
#Light Gray  0;37    White        1;37 
 
PROMPTCOLOR='\[\e[1;37m\]' 
COMMANDCOLOR='\[\e[0;37m\]' 
ROOTCOLOR='\[\e[1;31m\]' 
NORMALUSERCOLOR='\[\e[1;32m\]' 
HOSTNAMECOLOR='\[\e[1;35m\]' 
DIRECTORYCOLOR='\[\e[1;33m\]' 
 
### username ### 
if [ `whoami` = "root" ] 
        then USERCOLOR=$ROOTCOLOR 
        else USERCOLOR=$NORMALUSERCOLOR 
fi 
PS1=$USERCOLOR"\u" 
 
### hostname ### 
PS1=$PS1$PROMPTCOLOR@ 
PS1=$PS1$HOSTNAMECOLOR$(hostname -s) 
 
### working directory ### 
PS1=$PS1$PROMPTCOLOR" [" 
PS1=$PS1$DIRECTORYCOLOR"\w" 
PS1=$PS1$PROMPTCOLOR"]" 
 
### prompt end marker ### 
PS1=$PS1$USERCOLOR" \$ " 
 
### command color ### 
PS1=$PS1$COMMANDCOLOR
Oh, and let me know what you think.
 
Old 09-05-2007, 09:06 PM   #3
lectraplayer
Member
 
Registered: Mar 2003
Location: a little west of Birmingham, AL, USA.
Distribution: Porteus 3.1
Posts: 932

Original Poster
Rep: Reputation: 32
Thanks! ...though I remember doing it with a command, and then putting it in /etc/profile to make it permanent. I was also hoping to put a stop to it blanking out, for example if I'm reading a page full of text in less (and no, I cannot read faster! ).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting 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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Terminal Colors carlosinfl Linux - General 1 02-25-2007 03:59 PM
colors in terminal cad Linux - General 1 01-03-2007 01:27 AM
Terminal Colors carlosinfl Linux - General 2 08-29-2006 03:52 PM
Terminal Colors chakkerz Linux - General 2 11-22-2004 10:01 PM
Terminal Colors dhrivnak Slackware 2 10-26-2003 04:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration