DevHeads.net

root .bash_profile?

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

Comments

Re: root .bash_profile?

By Stephen John Smoogen at 05/13/2019 - 09:11

While moving /root to /home/root is done in someplaces, it only works if
/home is not on a different partition. If you put /home on a different
partition you will find all kinds of weird behavior happening on start up.

Re: root .bash_profile?

By John Austin at 05/13/2019 - 08:49

On Mon, 2019-05-13 at 08:28 -0400, Bee.Lists wrote:
For the occasions when it is desirable NOT to cd /root

I have an alias in /root/.bashrc
alias sbp='source ~/.bash_profile'

ja@naxos ~ 2$ pwd
/home/ja
ja@naxos ~ 3$ su
Password:
root@naxos ja 1001$ pwd
/home/ja
root@naxos ja 1002$ sbp
[root@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!

Re: root .bash_profile?

By nux at 05/13/2019 - 08:38

Hi,

The $home of root is /root, just copy it there.