Navigating into File system in Linux🐧

Navigating into File system in Linux🐧

Table of contents

Hey all👋,

Hope you all are doing well. In this blog, I will be sharing the information about commands which will help you in navigating into file system in Linux. The blog will be consisting of CLI snippets along with some examples.

Before directly starting with practicals, let's know what file system in Linux is?

File system in Linux

A file system can be defined as a structure where OS stores the data on disk drives. This might include:

  • Files
  • Directories
  • Information needed to access and locate them

Let's understand the concept more clear with the help of real life example. There are multiple rooms in our house. We place the T.V in living room, Utensils in kitchen, Beds in Bedroom. There is a systematic way where we place all these stuffs. The file system operates exactly in the same way in OS. The command files, devices, applications, all of them are placed/stored in their specific folders which allows OS in easily accessing them. Thus T.V, utensils can be analogous to data & kitchen, bedroom can be analogous to disk drives here.

Now lets come to practical side. We will focus on some commands which will help us in navigating into file system.

  • cd command:
    cd here means "change directory". It helps us in navigating from one file/directory to another in Linux.

for eg: If you want to move to "tmp" directory in Linux, then you can use following cd.PNG

  • ls command:
    ls means "list". It helps us in listing all the files/directories.

for eg: If you want to see which files/directories are there in "tmp", you can use following ls.PNG

  • pwd command:
    pwd means "print working directory". It tells the current directory in which you are, or you can say, it prints full path to working directory starting from root.

for eg: If you want to see, in which directory you are currently, then use the following pwd.PNG

Also, there are two ways in which we can navigate into file system:

  • Absolute path:
    With this way, we can navigate in one go to the desired location in Linux

eg: Assume you want to navigate to "myfile1" directory which is inside "Linux" directory and you are currently at root, then absolute.PNG

  • Relative path:
    With this way, we can navigate to desired location by iterating "cd"

eg: Assume you want to navigate to "myfile1" directory which is inside "Linux" directory and you are currently at root, then relative.PNG

Hope this blog gave you pretty much idea about basic navigation into Linux file system. We will explore more in next upcoming blogs.

Have a nice day🙌