Skip to main content

Navigating the Linux File System Using Terminal Commands

The command line interface (CLI) is an essential part of any Unix-like operating system, such as Linux. It provides direct, text-based control over your system. For those unfamiliar with the Linux operating system, using the terminal may seem daunting. However, once you become comfortable with some basic commands, you'll find the terminal can offer quicker, more efficient ways to navigate your system and manage your files.

This article provides a comprehensive introduction to some of the most common commands used to navigate the Linux file system, including cd, ls, pwd, and more. The understanding of these commands is foundational for anybody looking to gain proficiency in Linux.

Basic Linux Terminal Commands

pwd (Print Working Directory)

The pwd command allows you to know your current location within your file system. After opening the terminal, type pwd and hit Enter. The terminal will print the absolute path of your current directory.

$ pwd

This tells you that you're currently in the "username" directory, which is a subdirectory of "home".

ls (List)

The ls command is used to view the contents of the current directory. By simply typing ls into the terminal, you'll get a list of all the files and directories in your current directory.

$ ls
Desktop Documents Downloads Music Pictures Videos

This command can also be combined with various options to change its output. For example, ls -l will display the output in a long listing format, which includes additional information such as file permissions, number of links, owner, group, size, and time of last modification. The ls -a command will show all files, including hidden ones (those starting with a ".").

cd (Change Directory)

The cd command is used to navigate between directories. You can navigate to a directory by providing the path to that directory as an argument to cd.

$ cd /home/username/Documents

If you want to move up one directory level, use cd ... If you want to go to your home directory, just type cd and hit Enter.

$ cd ..
$ cd

While using the cd command, you may need to specify the path to the directory that you want to change to. This path can be defined in two ways - as an absolute path or a relative path. Understanding these two concepts is key to navigating the Linux file system efficiently.

Absolute Path

An absolute path is a complete path from the root directory (/) to the destination directory or file. It’s like using a full address when sending a letter; it does not matter where we are, this address will always take us to the destination.

For example, consider that you're currently in the /home/username/Documents directory and you want to navigate to the /var/log directory. You can do this using an absolute path as follows:

$ cd /var/log

After running this command, your current working directory will be /var/log, irrespective of your initial directory. The absolute path always starts with the root directory (/).

Relative Path

A relative path, on the other hand, is defined relative to the current directory. It’s like giving directions from your current location to where you want to go.

For example, if you're currently in the /home/username directory and you want to navigate to the Documents directory (which is a subdirectory of your current directory), you can do this using a relative path as follows:

$ cd Documents

Another example is when you want to navigate to a directory that's one level up (the parent directory) from your current directory. You can do this using the .. notation, which represents the parent directory.

$ cd ..

After running this command, if your initial directory was /home/username/Documents, your current working directory will now be /home/username.

The . Character

In Linux, the . character represents the current directory. Thus, when you type ./Documents, you're specifying the Documents directory in the current directory.

For example, if you are currently in the /home/username directory, you can navigate to the Documents directory using:

$ cd ./Documents

This command will change your current working directory to /home/username/Documents.

This is equivalent to using:

$ cd Documents

Both commands do the same thing, which is changing the current directory to the Documents subdirectory.

The ./ is often optional in the cd command, but it can be necessary in other situations for specifying that a file or directory is in the current directory. For instance, when running scripts or programs in the current directory, you would use ./ before the program name.

It's worth noting that using relative paths can save you a lot of typing when navigating directories close to your current directory. However, for directories located elsewhere in the filesystem, absolute paths can be more efficient and clearer.


The Linux terminal is an immensely powerful tool, granting you control over nearly every aspect of your system. While this article only covered a handful of the most common commands, there are many more available, each serving a unique purpose. As you become more comfortable in the Linux environment, you'll find that the terminal is not only useful, but essential for efficient system navigation and management.

Always remember, the man command is your friend. This command, short for manual, provides documentation for other Linux commands. For example, man ls would display the manual page for the ls command.

Happy navigating!

TypeScript Course Instructor Image
TypeScript Course Instructor Image

Time To Transition From JavaScript To TypeScript

Level Up Your TypeScript And Object Oriented Programming Skills. The only complete TypeScript course on the marketplace you building TypeScript apps like a PRO.


What Can You Do Next 🙏😊

If you liked the article, consider subscribing to Cloudaffle, my YouTube Channel, where I keep posting in-depth tutorials and all edutainment stuff for ssoftware developers.

YouTube @cloudaffle