Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-06-2002, 12:11 AM
|
#1
|
LQ Newbie
Registered: Oct 2002
Posts: 2
Rep:
|
Setting up host in Terminal?
I'm using RH8, I was wondering how to change the host/prompt in the console.
For example, mine looks like: [CauSTiC@The-Lab CauSTiC]$
That's one too many caustic's for me. I'd rather just have [CauSTiC@The-Lab]$ if possible.
Is it?
Thanks in advance!
Peace
Last edited by CauSTiC; 10-06-2002 at 01:14 AM.
|
|
|
10-06-2002, 03:38 AM
|
#2
|
Senior Member
Registered: Jan 2002
Location: Rome, Italy ; Novi Sad, Srbija; Brisbane, Australia
Distribution: Ubuntu / ITOS2008
Posts: 1,207
Rep:
|
Of course it's possible, read man bash, about PS1 and PS2 variables, you can even change the colour of your prompt, also search the web for bash prompt customization or such, and then i know they have a section about this on muhri.net (tips and tricks section) and somewhere on linuxbrit.co.uk too.
Meanwhile here's mine:
#!/bin/bash
# Start - bash prompt colours
# Folloing lines define coloured bash prompts
# Green () for normal users Red () for root
COLOR1="\[\033[0;36m\]"
COLOR2="\[\033[0;32m\]"
COLOR3="\[\033[0;36m\]"
COLOR4="\[\033[1;37m\]"
if
[ "$UID" = "0" ];
then
# I am root
COLOR2="\[\033[1;31m\]"
fi
PS1="$COLOR2--($COLOR3\d, \t$COLOR2)--$COLOR2($COLOR3\u@\H$COLOR2:$COLOR1\w$COLOR2)$COLOR1\\$ $COLOR4"
# End - bash prompt colours
HTH
-NSKL
|
|
|
10-06-2002, 04:06 AM
|
#3
|
Member
Registered: Aug 2002
Distribution: Slackware 8.1
Posts: 750
Rep:
|
???
NSKL:
Can you advise me how to make my PS1 red?
mine is: PS1="\u@ \w# "
???
|
|
|
10-06-2002, 05:00 AM
|
#4
|
Senior Member
Registered: Jan 2002
Location: Rome, Italy ; Novi Sad, Srbija; Brisbane, Australia
Distribution: Ubuntu / ITOS2008
Posts: 1,207
Rep:
|
I just stuck the shell script i posted above into /etc/profile.d and called it shell.sh , and bash reads it every time it starts.
Now to make your prompt red you'll probably want to edit the script above, thats the easiest way i beleive.
Also check out http://www.linuxbrit.co.uk/bashprompt/ and just edit some of his scripts to fit your needs. Also read on ASCII color codes (i beleive its called like that) to learn the codes for colours, they are used in my script above, and the scripts from the link i gave you.
Also if i recall well theres a nice explanation about this in the bash HOW-To or the bash prompt HOW-TO...
Hope that helps
-NSKL
|
|
|
10-06-2002, 05:14 AM
|
#5
|
Member
Registered: Aug 2002
Distribution: Slackware 8.1
Posts: 750
Rep:
|
Reading Bash-prompt howto I have discovered many interesting things 
|
|
|
10-06-2002, 05:36 AM
|
#6
|
Member
Registered: Aug 2002
Distribution: Slackware 8.1
Posts: 750
Rep:
|
One more question, I have puted such command:
PS1="\[\033[0;031m\]\u@ \[\033[0;31m\]\w# "
So everything I type becomes red, and want red to be only the prompt???
|
|
|
10-06-2002, 07:54 AM
|
#7
|
Member
Registered: Aug 2002
Location: Mumbai,India
Distribution: Linux Mint 12, Gentoo
Posts: 230
Rep:
|
To make only the prompt red the command line should go like this
PS1="\[\033[0;031m\]\u@ \[\033[0;31m\]\w# \033[0;0m\]"
|
|
|
All times are GMT -5. The time now is 10:51 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|