Change terminal command prompt for root user in Sierra I can change the bash command prompt for the Terminal for an ordinary user without issue. (In my case, I modified the $PS1 variable in /etc/bashrc.) However, that change does not modify the command prompt when one elevates privileges to root using sudo -s.  

Does anyone know where the command prompt preference is stored on a macOS Sierra (10.12.5) machine for an admin user who has elevated his privileges to root using sudo -s?

I have tried modifying the following files...


/var/root/.bash_profile
/var/root/.bash_rc
/var/root/bash_rc
/var/root/.profile
~/.profile


I have also tried using the command export PS1="Some prompt here# ", which changes the root prompt temporarily, but it does not stick when the session is ended and a new one is started.
Add the SUDO_PS1 environment variable to your ~/.bash_profile and then export the variable, such as:

export SUDO_PS1="\[\h:\w\] \u\\$ "

Note however this will only change the root prompt as it appears after you have elevated your rights via sudo.

A good list of prompt variables can be found here.