[CentOS] root .bash_profile?
ja
ja at jaa.org.uk
Mon May 13 12:49:01 UTC 2019
On Mon, 2019-05-13 at 08:28 -0400, Bee.Lists wrote:
> Hi folks. Just wondering how I can implement an automatic .bash_profile for root. I have to load my
> user .bash_profile every time I get into root, and I would like a better solution. There is no /home/
> for root, so I’m a bit confused if this is even allowed.
>
> Any insight appreciated.
>
>
> Cheers, Bee
>
For a "normal" installation root's home directory is /root
>From a users account the "-" will source /root/.bash_profile
and change to root's home directory.
ja at naxos ~ 1$ su -
Password:
[root at naxos:~]$ pwd
/root
[root at naxos:~]$
For the occasions when it is desirable NOT to cd /root
I have an alias in /root/.bashrc
alias sbp='source ~/.bash_profile'
ja at naxos ~ 2$ pwd
/home/ja
ja at naxos ~ 3$ su
Password:
root at naxos ja 1001$ pwd
/home/ja
root at naxos ja 1002$ sbp
[root at naxos:/home/ja]$ pwd
/home/ja
/root/.bash_profile
changes the colour of the prompt (among other things)
PS1="\[\033[1;31m\][\u@\h:\w]$\[\033[0m\] "
There must be much better ways of doing this!
More information about the CentOS
mailing list