Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

setting user prompt

SOLVED
Go to solution
mw_4
Frequent Advisor

setting user prompt

/bin/bash shell
user@host[pwd]
pwd is full path can anyone help me...?
Step by step
3 REPLIES
I_M
Honored Contributor

Re: setting user prompt

Hi

I am using RH7.3.
The default prompt is [user@host dir]$.

Then I checked out "echo $PS1".
[\u@\h \W]\$

So I want to change my prompt something like yours, I set my PS1 as,

PS1=\\u@\\h[\\W]\$

Of course you have to put this command into your .bash_profile or .bashrc in your home directory.

Good luck
Kodjo Agbenu
Honored Contributor
Solution

Re: setting user prompt

Hello,

Try :

export PS1="`whoami`@`hostname`[\$PWD] "

Good luck.

Kodjo
Learn and explain...
Stuart Browne
Honored Contributor

Re: setting user prompt

The token for the 'full path' (as against just the last dir in path) is \w, not \W.

so:

PS1='\u@\h[\w]\$ '

This is covered in 'man bash', under the section 'PROMPTING'.
One long-haired git at your service...