Linux Navigation For Beginners
Tags: beginners, linux, ubuntu, computerscience
Published: 2020-05-04 05:29:40

In this post, we are going to explore commands related to navigation in the Linux Operating System(OS). Although I am using Ubuntu these commands will work on any Linux distribution.So let's start

Now for navigating from one directory/folder to another directory we first need to find out where we currently are.

So how can we do that?

## 1.`pwd` command

`pwd` stands for print working directory. We use `pwd` command to find out which directory we are currently working in.

![pwd command example](https://dev-to-uploads.s3.amazonaws.com/i/x6siuz5xl79u5wcfp8b6.png)

From the above image, we can see that we called the `pwd` command and it gave us the result that we are currently working on the /Downloads directory/folder of user **linux-learning**.

Now that we know how to check for the current working directory, the next question is how do we find out all the files and folders in our current directory.

##2. `ls` command

To solve the problem we discussed above we use the `ls` command. `ls` stand for **list**.

Okay, `ls` means list but **list** of what?

The command `ls` is used to List information about the files and folders.

![ls command example](https://dev-to-uploads.s3.amazonaws.com/i/p1odk0y3xuboubwtdljm.png)

From the above image, we can see that we called `ls` command and it gave us the result that there are currently 10 folders inside our current directory.

Now the next question that comes up is ok we found out that we have 10 folders in our current directory but how can we go inside one of those folders?

##3. `cd` command

To go inside another directory from our current directory we use the `cd` command. `cd` stands for **change directory**.

Okay but how?

The syntax for the `cd` command

`cd <directoy_name>`


![cd command example](https://dev-to-uploads.s3.amazonaws.com/i/ofgolbo13vfudcrbqyk1.png)

From the above example, we can see that we first use

`ls` command to **list** all the files and folders

then we decided to go into folder1 so we use our newly found command

`cd` to **move into** folder1

To verify that we have reached our destination folder can you guess which command we can use?

Yeah! you guessed it right `pwd`

![cd with pwd example](https://dev-to-uploads.s3.amazonaws.com/i/a6xx7l3fwzmv3qlt52fh.png)

Okay now we checked our current working directory with `pwd` then we checked all the files and folders in our current working directory with `ls`. Then we moved into a new directory using `cd`.

Now the only step that is remaining is how do we go back to the previous folder?

To go back to the previous folder we again use our `cd` command

![cd back example](https://dev-to-uploads.s3.amazonaws.com/i/r1sjtumo77116npzdey1.png)

From the above example, we can see that we can use cd .. for going back to the previous folder.

Now the biggest question is what is the meaning of ..?

In Linux OS there are two references that are stored in each and every folder.
    1. The <b>..(double dot)</b> which is a reference to the previous folder.
    2. The <b>.(dot)</b> is a reference to our current folder.

But if these references are present in each folder how come we did not see them when we use ls command?

So these references are hidden and to view these references using `ls` command we use the option `ls -a` which returns us all the files and folders even the hidden ones.

![ls -a example](https://dev-to-uploads.s3.amazonaws.com/i/w0la23wobxsyu80r95d6.png)

Okay, so that’s all the basic navigation we need to explore Linux filesystem.

I hope you understood the basics of navigation in Linux. Please, let me know if there are any questions.