1827286 Members
3772 Online
109717 Solutions
New Discussion

Re: path prompt

 
SOLVED
Go to solution
Wamaitha
Frequent Advisor

path prompt

hello, i want to change the prompt so that it shows the hostname and the current directory that the user is at. i need to make this a global variable so that every user who logs get this.
thank you in advance.
4 REPLIES 4
john kingsley
Honored Contributor
Solution

Re: path prompt

Add the following lines to the bottom of /etc/profile

PS1=`hostname`":"`$PWD`"$ "
export PS1
Alan Meyer_4
Respected Contributor

Re: path prompt

set the following in /etc/profile

HOST=`hostname`
PS1="${HOST}:`pwd`> "
export PS1
" I may not be certified, but I am certifiable... "
Rodney Hills
Honored Contributor

Re: path prompt

I like to only display the last directory in a path (sometimes they can get pretty long), so I would recommend-

HOST=`hostname`
EXPORT PS1="${HOST}:${PWD##*/} $ "

HTH

-- Rod Hills
There be dragons...
Wamaitha
Frequent Advisor

Re: path prompt

thank you all, the 2 responses helped me alot, i will try Rodney's suggestion once it gets to that point where the path is too long.