\h or \H will print out the host name.
If I change PS1 by the command: export PS1="\h@\H\$" I get the prompt:
jschiwal @ matrix.jesnet$
My default PS1 is set to "[\u@\h \W]\$". The host entry tells me where I'm logged in to.
The bash shell uses different startup files for a log-in session.
/etc/profile, then ~/.bash_profile, then ~/bash_login then ~/.profile. When logging out, bash reads and executes the commands in the file ~/.bash_logout.
When the shell is not a login session, ~/.bashrc is executed instead. The .bashrc file probably contains a test for /etc/profile, and executes it if it exists. But you could change this behaviour if you wanted to.
This is a little bit different from what you asked, but might give you an Idea which startup file should change PS1.
If you type: info bash and then PS1, you can find a listing of all of the prompt codes.
I think there is also a BASH PROMPT HowTo around with advice on what you might want in your prompt.
Last edited by jschiwal; 01-26-2004 at 11:41 PM.