Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I can't tell what machine I'm on!

Status
Not open for further replies.

630111

MIS
Oct 30, 2001
127
US
How do I alter the command prompt so that instead of a plain-ol' "# " I'd have something more descriptive like "mymachine /opt #"

Thanks!

630111
 
in ksh:

PS1="`uname -n`: `echo $PWD` # "
PS2="`uname -n`: `echo $PWD` > "
export PS1 PS2

in csh:

set prompt="${host}:`dirs`\!}- "
One by one, the penguins steal my sanity. X-)
 
in bash:
export PS1="\u@\h::\w # "

it will have a similar format to:

root@prodhp1::/tmp #

crowe
 
My shell is /bin/sh, and ayjaycee's suggestion worked, except that the pwd part of the prompt stays the same no matter what directory I'm in. Also, when I su to root, I lose all the PS1 and PS2 changes. Lastly, none of this shows up at all in X sessions. Help?

Thanks!
 
If you logon to one server and run x-sessions to the others, you can try:
alias <servername> 'cmdtool -Wl &quot;servername&quot; rlogin -l <username> <servername> &' (all on ane line )
This should give you a window with the name of the server on the top.
If you have several windows open at the same time it stops the confusion of which session is in which window.
 
For sh, try

PS1=&quot;`uname -n`: `pwd` # &quot;
PS2=&quot;`uname -n`: `pwd` > &quot;
export PS1 PS2

When you su to root, you're starting a new session & will have to make the same changes to root's .profile
One by one, the penguins steal my sanity. X-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top