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!

modify Command prompt

Status
Not open for further replies.

zoonkai

MIS
May 1, 2000
71
0
0
US
I want to modify the command prompt on one of my UNIX boxes....I have done this before, but cannot for the life of my find my notes on it.

I don't care if it changes the prompt on every login or just on root..because I only use root's account on this machine..

Instead of...

#

I want something like

<Machine Name> #

any help would be appreciated
Thanx

Zoonkai
 
Zoonkai,

You do that by redifining the PS1 environment variable, for example:

[tt] PS1=&quot;thebeast # &quot;[/tt]

You might want to add this to your .profile, and perhaps make it more generic, for example:

[tt] PS1=`uname -n`&quot; # &quot;[/tt]

`uname -n` would be replaced with the node name of the machine.

Annihilannic.
 
There is an environment variable called &quot;PS1&quot; - This is Prompt String 1, and is the default shell prompt. You should find that, for root, it is currently set to &quot;# &quot;.

To change it for a user, edit their .profile and set PS1 to whatever you want. For example:
[tt]
PS1=&quot;myserver.com # &quot;
export PS1
[/tt]
On a cautionary note, you might want to think about setting up a normal account that you can use for day to day work on the machine. From experience, a mistyped &quot;rm -r /my/directory&quot; can cause havoc... Think along the lines of &quot;rm -r / my/directory&quot; and ponder the fact that you probably won't be told that &quot;my/directory&quot; can't be found until everything else has been wiped off the system... The feeling when you start to think &quot;It shouldn't be taking this long to delete a few files, and why is the hard disk thrashing like mad?&quot; can be quite un-nerving.

It's the kind of mistake you only make once, but it can be a costly one.

Having a non-root user for day to day work is generally considered a Very Good Idea when using Unix.

Hope this helps.
 
Thank you both...works great now.....!!!

Andy
I definetely agree with you about being careful using root access. The machine that I'm doing this on is our &quot;dummy&quot; machine..used for writing and testing programs...if i ever goofed up it won't lose anything other than maybe my current project...the important company data is secure on another box.....that's why i wanted to label my command prompt....so in case i was in question...i would always be able to tell which machine i was at just by getting to a command prompt if i'm not already there....

thanx a bunch !!

Donald (Zoonkai) Dixon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top