LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Questions about bash colors.... (https://www.linuxquestions.org/questions/linux-newbie-8/questions-about-bash-colors-44164/)

jcornel7 02-05-2003 06:22 AM

Questions about bash colors....
 
OK I admit it I am new to linux. The question i am sking has no use but for me to look cool. :) (Just Kidding)

Anyways...

obvisouly my prompt now says user@hostnname dir

How do I keep the exact same prompt but with a blue background and bold yellow text. (University of Michigan Student)

Then how do I keep that permanent for who ever logs in?

Thanks for your help!!!

salparadise 02-05-2003 08:16 AM

look for "current profile" or "edit profile" in one of the drop menus on top bar of terminal window

all colours etc are changed from there

jcornel7 02-05-2003 10:18 AM

Ummm.....Yes I am aware on how to do it in X. However i am strictly taking in a terminal session. I dont run X.

peeples 02-05-2003 10:29 AM

Look in either your .bashrc or your .bash_profile
One or the other should have "PS1="

This is your prompt.

Now do a google search for "ASCII codes", somewhere you will find color codes. Insert the color codes in right after the equals sign in your PS1 statement. Right now I have a yellow prompt for a normal user, and a red prompt for root. I'm not sure about how to change the background color, but maybe you will find that info when searching for the ASCII codes.

To make this work for all users, you will have to do the changes to the bash configuration file that is located (I think) in /etc.
Also, you may have to add the change to /etc/skeleton (or somesuch), so that it will be active for all newly created users. To make changes for root user, change it in /root/.bashrc.

HTH

jcornel7 02-05-2003 11:40 AM

Do you have any specific syntax? (I am a newbie)

mhearn 02-05-2003 01:34 PM

function normal() { echo -en "\033[m\017"; }
function red() { echo -en "\033[1;31m"; }
function green() { echo -en "\033[1;32m"; }
function blue() { echo -en "\033[1;34m"; }
function lilac() { echo -en "\033[1;35m"; }
function cyan() { echo -en "\033[1;36m"; }
function white() { echo -en "\033[1;38m"; }
function bold() { echo -en "\033[m"; }

Only cos you're now ;) In future, use google power.

mhearn 02-05-2003 01:35 PM

oh.... so PS1="\033[1;36m"

that controls foreground colours only. man tput for more info, i think that'll cover bg colours

bulliver 02-05-2003 02:13 PM

Read the bash prompt howto:
http://www.shelluser.net/~giles/bash...wto/book1.html

Should answer all your questions.


All times are GMT -5. The time now is 09:00 PM.