Re: root .bash_profile?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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@naxos ~ 1$ su -
Password: 
[root@naxos:~]$ pwd
/root
[root@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@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!


_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux