The Computer Oracle

Where's .bashrc for root?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping

--

Chapters
00:00 Where'S .Bashrc For Root?
00:30 Answer 1 Score 28
01:14 Accepted Answer Score 34
01:31 Answer 3 Score 4
01:50 Answer 4 Score 1
02:05 Thank you

--

Full question
https://superuser.com/questions/268460/w...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #root #bashrc

#avk47



ACCEPTED ANSWER

Score 34


Probably best to put them in ~/.bashrc . It seems root doesn't get the normal ones by default in some distros, but you just cp /etc/skel/.bash* ~ to fix that.




ANSWER 2

Score 28


How about the home dir of root that is /root/?

From some aspects, root is just another user (just better, and allowed more). root has a home dir, but it is not like the other users in /home/, but simply /root/ so root:s .bashrc is therefore /root/.bashrc

The ones in /etc is system specific settings for all users, including root.


Thanks to grawity to point out that you can use ~root points to the root home dir, regardless of where it is.

You can test that with

$> echo  ~root
/root

So even thou /root will work on 99% on the systems out there ~root is probably more portable and will probably work on 100%.

~root/.bashrc



ANSWER 3

Score 4


Instead of using /root/.bashrc try using /root/.profile — it's the same thing, just a different name.

Also, if you are using su to get into root it may not be reading the .bashrc or .profile – just issuing su will not run the login scripts. try doing

su -



ANSWER 4

Score 1


Normally the .bashrc file for the root user should be there: /root/.bashrc
If it is not the case, you can copy the 2 following files into /root, then you can edit the .bashrc file as you want.

cp /etc/skel/.bash_profile /root
cp /etc/skel/.bashrc /root