How do you get to the Linux root directory in terminal mode?
I am asking this on behalf of my colleague.
My colleague is now using his Linux Desktop and is at the Linux terminal option. He is trying his very best to get to the root directory, but to no avail. All his efforts are in vain.
He is now stuck in the "username@username-desktop:~$" environment.
How can he go to the root directory?
Mail this postPopularity: 1% [?]
6 Comments »
RSS feed for comments on this post. TrackBack URL
First he needs to be the root user, a normal user won’t have access to that location. To become root user type this at the prompt.
su – then <enter>
type root’s password
now type cd / (cd space forward slash)
Now you are in the root directory.
Be careful what you do as root superuser, the computer assumes you know what you are doing once you become root.
In response to below:
Yes you can look all you want as a normal user, I’m presuming you actually want to modify a system file, not just look.
HTH – Good Luck,
-Aaron
try
cd ..
several times or I believe
cd / will work
Try cd /
Your prompt will change from a ~$ at the end to a /$ at the end. Believe it or not, that’s the directory you’re currently in.
If you’re in the /etc/apt directory, your prompt will look like username@username-/etc/apt$
The reason you see a ~ is because ~ is a shortcut to your home directory. On most linux systems, you’ll find it at /home/username.
In response to the above commenter: Normal users have read-only access to most of the system, with the exception of sensitive files like password lists or SSH private keys. You can look around quite safely as a normal user without hurting anything.
How do you know whether you’re a normal user or not? If your prompt ends in a $, then you’re a normal user; if your prompt ends in a # then look out because you’re working as root.
Oh, about that: Root is the name of the admin account on Linux. He can do anything he wants to his computer including completely breaking it with a single command. Root’s home directory (also sometimes called the "root directory", but I don’t think that’s what you meant) is in /root. The root directory / and root’s home directory /root are two completely different things. Don’t get confused, now!
To become root, use "sudo -i". The problem with su is it asks for root’s password and not your password, but root’s password is usually locked so nobody can break in by guessing it. Therefore, "su -" is depreciated on most of the systems you’ll likely come across (if they’re properly updated, that is)
cd /
or
cd /root
you do not need to be in super user mode (su)
$sudo su -
Then enter your password to become root
#cd /
cd / will work in any casse