1830487 Members
3033 Online
110005 Solutions
New Discussion

Root Prompt Profile

 
SOLVED
Go to solution
Mauro_8
Frequent Advisor

Root Prompt Profile

Hi,

I want to change the PROMPT for user root. The prompt is only "#" and I want to change to "hostname - ROOT $". The root shell is /sbin/sh and the home directory is "/". I try to change in .profile but did not have success.

Cheers,
Mauro
6 REPLIES 6
Steve Steel
Honored Contributor
Solution

Re: Root Prompt Profile

Hi

export PS1=$(hostname):\$PWD" # "

as last line of .profile


Be aware that your .profile may not always be read

especially by CDE


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)

Re: Root Prompt Profile

Mauro,

beware of straying away from standards - I'd never use '$' in the prompt for root, as some sysadmin might come along and think he's not root... (one rm -rf later...)

Stick to using '#' at the end of roots prompt, you can put anything else before this though.

HTH

Duncan

I am an HPE Employee
Accept or Kudo
James R. Ferguson
Acclaimed Contributor

Re: Root Prompt Profile

Hi:

Steve has already given the syntax for changing the PS1 prompt in your profile. Howver, be aware that *by standard* root's PS1 prompt is "#" whereas the PS1 prompt of a non-root user is "$". I would suggest you stay with the segregation of those two characters regardless of what else (hostname, current working directory, etc) you add to the PS1 string.

Regards!

...JRF...
Sanjay_6
Honored Contributor

Re: Root Prompt Profile

Hi Mauro,

Try this in the root .profile,

export HOST=`/usr/bin/hostname`
export PS1='$HOST - $LOGNAME =>'

Hope this helps.

Regds
MANOJ SRIVASTAVA
Honored Contributor

Re: Root Prompt Profile

Hi Mauro

This is for default KSH

HNAME=`hostname`
PS1='$HNAME:$PWD:#'



Manoj Srivastava
Andrea Pagani
Occasional Contributor

Re: Root Prompt Profile

Try with

PS1="`hostname` - ROOT $"

in /.profile

Andrea