Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
same question on stackoverflow: stackoverflow.com/q/12228559/7552 – glenn jackman Sep 1 '12 at 15:00
up vote 1 down vote accepted
sudo su - ###gets you to /root, as the root user.
share|improve this answer

Simply use cd /root if you just want to go there :)

sudo -s may not update all environment variables so some aspects of your shell is still the old one. You can use sudo -i, or one of the methods described in How do I run a command as the system administrator (root).

share|improve this answer
sudo su # proper user switch
cd # goes to $HOME by default
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.