LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 10-06-2002, 12:11 AM   #1
CauSTiC
LQ Newbie
 
Registered: Oct 2002
Posts: 2

Rep: Reputation: 0
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.
 
Old 10-06-2002, 03:38 AM   #2
NSKL
Senior Member
 
Registered: Jan 2002
Location: Rome, Italy ; Novi Sad, Srbija; Brisbane, Australia
Distribution: Ubuntu / ITOS2008
Posts: 1,207

Rep: Reputation: 46
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
 
Old 10-06-2002, 04:06 AM   #3
nautilus_1987
Member
 
Registered: Aug 2002
Distribution: Slackware 8.1
Posts: 750

Rep: Reputation: 30
???

NSKL:
Can you advise me how to make my PS1 red?
mine is: PS1="\u@ \w# "
???
 
Old 10-06-2002, 05:00 AM   #4
NSKL
Senior Member
 
Registered: Jan 2002
Location: Rome, Italy ; Novi Sad, Srbija; Brisbane, Australia
Distribution: Ubuntu / ITOS2008
Posts: 1,207

Rep: Reputation: 46
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
 
Old 10-06-2002, 05:14 AM   #5
nautilus_1987
Member
 
Registered: Aug 2002
Distribution: Slackware 8.1
Posts: 750

Rep: Reputation: 30
Reading Bash-prompt howto I have discovered many interesting things
 
Old 10-06-2002, 05:36 AM   #6
nautilus_1987
Member
 
Registered: Aug 2002
Distribution: Slackware 8.1
Posts: 750

Rep: Reputation: 30
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???
 
Old 10-06-2002, 07:54 AM   #7
sandy
Member
 
Registered: Aug 2002
Location: Mumbai,India
Distribution: Linux Mint 12, Gentoo
Posts: 230

Rep: Reputation: 30
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\]"
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help setting host name please? MichaelD Linux - Newbie 1 05-20-2005 10:33 PM
Linux Terminal Server and Host/Client processing workloads X_ArchAngel Linux - Networking 0 02-16-2005 08:11 PM
Setting up a virtual host zupidupi Linux - Networking 2 01-30-2005 08:58 AM
Setting the Host name xailer Linux - Newbie 9 11-18-2003 08:35 PM
Setting up host in Terminal? CauSTiC Linux - Newbie 3 10-06-2002 06:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:23 PM.

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