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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Terminal configuration

Status
Not open for further replies.

soloxis

MIS
Feb 11, 2002
23
0
0
AU
Hi,
How can I configure my terminal to show me in the prompt the curent path and the name of machine, for example <icar1/etc>
Thanx,
Cristian
 
You can use the PS1 variable as follows:

PS1=&quot;\$PWD =>&quot;

That would at least get your location in the Unix prompt string. To avoid having to set this variable each time you login, you could set the variable in your .profile.

As far as the system name you should be able to include uname in the above string as follows:

PS1=&quot;'uname -n' \$PWD =>&quot;

However, I've actually not been able to successfully include my system name using the above way, anyone have an answer to that?
 
Here's how I do it:

add to profile the following:
export HOST=`/usr/bin/uname -n`
export USER=`/usr/bin/id -nur`
export PS1='$USER@$HOST: $PWD >'

Note the single quotes. The first two lines have the &quot;backward&quot; ones and the last line has the usual ones. I put a space between the colon after the host name and the $PWD so I can double-click a path and paste it when I'm using an xterm.

I've never understood why having at least the $PWD in the PS1 isn't the default, especially for root.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top