Introduction to the Linux filesystem 

  • Post author:
  • Post category:Linux
  • Post last modified:November 13, 2023
  • Reading time:6 mins read
You are currently viewing Introduction to the Linux filesystem 

Operating systems need computer resources to run, which include processors, volatile memory (RAM), non-volatile memory (hard drives), and others. The processes through which operating systems organize and manage their files can vary from one to another (e.g., Linux handles its files and directories differently from how Windows does it). Today, you will learn about the Linux filesystem and how it organizes files.

Filesystems

A filesystem is a structure that an operating system uses to store files and retrieve them. The filesystem stores these files on a hard disk. Files include its content plus its related metadata. Metadata is the “data about the data” and is used to describe each file. Examples of metadata include creation date, modified date, size, rights, and more.

The Linux filesystem

The Linux filesystem is hierarchical, which means that directories and files belong to another directory, which can belong to another directory, and so on. The root directory, represented by a forward slash (/), is the top-level directory.

The root directory contains several files and directories, each having a function. Some of these directories include (but are not limited to) are:

/bin

The /bin directory contains commands users can run, such as cat, chown, ls, mkdir, whoami, and more.

/boot

This directory contains the directories and files required for booting the operating system.

/dev

The /dev directory (short for device) contains files that allow interaction with hardware devices (e.g., hard disks, RAM, etc.).

/etc

The /etc directory is where you can find system configuration files and other miscellaneous files.

/home

If a user has a login account assigned, you can locate their account home directory inside /home.

As mentioned before, there are several directories that you can find in the root (/) directory. I encourage you to explore them and get more familiar with their contents.

Absolute paths vs. Relative paths

As you explore these directories more, you might need to refer to their location (also known as “path”). This path can be absolute (when it starts with the root directory) or relative (when it begins from the current working directory).

An absolute path might look like: /home/joe/Documents/myfile.txt.

It means the root directory (/) contains a directory called “home” that contains another directory called “joe” which includes a folder called “Documents” and the “myfile.txt” file is inside of it.

On the other end, if you are on a working directory /home/joe

A relative path might look like Documents/myfile.txt. And as you can see the difference, you don’t have to refer to the whole path from the root directory, and it’s relative to the current working directory.

Conclusion

There is more to explore in the Linux filesystem. This post is just an introduction and I hope everything starts to make more sense from here. I encourage you to carefully navigate the Linux filesystem directories and become more familiar with them and what they contain.

Please feel free to follow us on our social media channels:

Jose Ponce

Jose is a Linux enthusiast with more than 10 years of Linux experience. His passion for Linux and other Free and Open-Source Software led him to start moreaboutlinux.com. On his free time, he enjoys reading books and drinking coffee.