How to go up one directory in Linux

Folders are just partitions a user makes in their computer system’s storage. These various folders must be given different names and are referred to as directories in Linux. In Linux, the terminal is the major method of performing various tasks. You can create, delete, and switch directories using the terminal. 

This article will demonstrate how the Linux terminal is utilized to go up one directory.

Method 1: Using the “cd” Command to Move Up One Directory

The “cd” command, also known as the change directory command, is the easiest method to move up/down in directories. To understand this command, it is important to understand that when the terminal is opened, it always opens up in the home directory of the system as shown below:

To go up one level from your home directory, simply use the “cd” command followed by the name of the directory that you wish to navigate. In our case, we are switching to the “Desktop” directory:

$ cd Desktop
how to handle linux files and direc...

Note: If you wish to navigate to more than just one directory up, then you can simply add the complete path of the directory as demonstrated in the example below:

$ cd /home/itslinuxfoss/Desktop/sample

Bonus Tip: Using the “cd” Command to Move Down to a Directory

If you want to go down to a specific directory, you can use the “cd” command as well. One of the best uses of the “cd” command is to get back to your “home” directory instantly. Let’s look at some usages of the “cd” command to move down the directories:

Jump to the “home” directory

Just write the “cd” keyword in the terminal to navigate to the “home” directory instantly:

$ cd

Move Down One Directory Only

In the case that you wish to navigate to just one previous directory then the “cd” command is utilized in the following method:

These were some of the most commonly used methods of utilizing the cd command to navigate back and forth in the directories of the Linux operating system.

Conclusion

The “cd” command is the key player in switching between various directories. You need to use the “cd” command alongside the directory’s name to go up one directory. This article has demonstrated how you can move up in the Linux directories. Additionally, the usage of the “cd” command to move down the directories is also provided.