Linux – how to access homedir by root user

bashlinuxsudounix

I want to access root user's home directory /root/. However following commands dont lead me to the root directory.

sudo -s

cd ~

It leads to the home dir of regular user. How to access /root when using sudo -s to login as root. I am using bash4 on ubuntu12.04.

Best Answer

Try cd /root.

~ is normally just a shorthand for the home directory, so if you are the regular user person then cd ~ is the same as cd /home/person.

Related Question