How do you get to the Linux root directory in terminal mode?

6
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?

By: GeorgeRock

About the Author:

Marketing Strategies

Filed under Programming & Design by on #

Comments on How do you get to the Linux root directory in terminal mode?

January 16, 2010

gclipse02 @ 3:25 am #

Marketing Strategies

try
cd ..
several times or I believe
cd / will work

January 17, 2010

✠ Aaron ✠ @ 12:09 am #

Marketing Strategies

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
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

January 18, 2010

Mike W @ 5:14 am #

Marketing Strategies

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-/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)

yrjokin @ 9:17 pm #

Marketing Strategies

cd /
or
cd /root

you do not need to be in super user mode (su)

January 20, 2010

raghav33 @ 2:02 am #

Marketing Strategies

$sudo su -
Then enter your password to become root
#cd /

techfreak @ 12:01 pm #

Marketing Strategies

cd / will work in any casse

Login