How to go to root directory in Linux

The root directory on a Linux system, which is represented by the / character, is the parent path to all files on the installation’s partition. All operating systems have a root directory. If you are familiar with Windows systems, they use the C:\ path as their root directory.

You will see references to the root directory all of the time. Even when looking at the absolute path to a random file, such as /home/linuxconfig/example.txt, you can see the / at the very beginning of the file path, which indicates the root directory. From this path, we can also derive that home is directly inside of the root directory /.

The term “root directory” can sometimes also be confused with the home directory for the root user account. This is typically located at /root, and resides one directory deep within the root directory /. The /root path is treated as any typical user’s home directory, and does not serve a similar purpose to that of the root directory /.

In this tutorial, you will learn how to navigate to the root directory on a Linux system. This means both the top most directory in the file system, /, and the root user’s home directory /root. Read on to learn how.

In this tutorial you will learn:

  • How to navigate to the root directory on Linux
  • How to navigate to the root user’s home directory
How to go to root directory in Linux
How to go to root directory in Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to go to the root directory in Linux



Twitter icon Follow LinuxConfig.org on Twitter for the latest tips and tricks about Linux!


You can navigate to the root directory on a Linux system by using the cd (change directory) command. As mentioned earlier, the root directory is represented with a forward slash /, so the command would be:

$ cd /
NOTE
The cd command is one of the most essential commands on Linux and you will be using it constantly in order to navigate to different directories via the command line on your Linux system. See our tutorial on cd command in Linux with examples for more information about the command.
Using the cd command to go to the root directory. The pwd command shows our present working directory
Using the cd command to go to the root directory. The pwd command shows our present working directory

To navigate to the root user’s home directory, /root, execute the following command:

$ cd /root

If you are already logged into the root user account, then just typing the following commands would also take you to the root user directory:

# cd
OR
# cd ~


Closing Thoughts

In this tutorial, we saw how to go to the root directory on a Linux system. The root directory is the top most directory in the Linux file system hierarchy, and should not be confused with the root user’s home directory. From the root directory, you can find all of the files that belong to your Linux installation’s partition, although files could possibly be buried dozens of sub directories deep.