Linux Filesystem Hierarchy

Linux Filesystem Hierarchy

by Elena Mofar, Published on May 23, 2023

Everything in Linux is a file.


So, bago tayo mag-start sa kahit na ano pa man, we need to familiarize ourself with how Linux handles their directories.


Ano yung mga default directories, and kung ano yung purpose of each.


Linux uses a hierarchical directory structure kung saan ang mga directories natin may contain both files and another directory (also called as a sub-directdory).


Yung main directory natin is called a parent directory, and yung sub-directory na nasa loob ng parent directory na yan is called a child directory.


So, For example, we have a directory Folder1 , and inside we have 2 Directories Dir1 and Dir2 :

Parent and Child Directory Illustration

If another directory exists inside Dir1, say Dir3 – then, Dir1 would be the parent directory of Dir3 and Dir3 would be its child Directory :

Parent and Child Directory Illustration

In Linux, all sub-directories are under its parent directory – the root directory, denoted by “/”.


The Root directory (/) is not a child of any directory, therefore, it is the topmost Directory in the Linux Directory Structure.


After installation, Linux creates default directories that are all located inside the Root Directory (/).


These default directories can be seen here:

We need to familiarize ourselves with the uses and functions of some of the most commonly used sub-directories.


These are the commonly used root sub-directories

/etc ( slash et-cee directory)


This sub-directory holds system configuration files.


As we further along with server and system configurations, we will be using and editing files located here.


/boot


Contains all files needed to boot your Linux machine


These includes the kernel, bootloader, and boot configuration files.


/home


This is where the home directories of users residing in our system are stored.


The home directory name of a user is equal to its username.


So, if we have a user with username john123, its home directory would be : /home/john123


/root (slash root directory)


The root user is the administrator user account for the entire Linux system.


It also has its own home directory separate from the home directories of our regular users.


The home directory of the root user resides in the /root directory.


/var (variable directory)


This directory contains variable data that changes while our Linux system is up and running.


This includes log files, spool, status and other variable dynamic data.


Also, when we are already in server configurations – you will see that servers like an HTTP server, FTP and Mail servers store their files inside the /var directory.


/dev (device directory)


As I’ve said, everything in Linux is a file – including device nodes for our physical and virtual devices.


For example, drives that are installed in our Linux machines are referred to as /dev/sda1 (for sata/scsi drives), /dev/md1 (for RAID arrays), etc. (I will be discussing more on these when we are already in Disk Storage Management)


/bin


Linux executable commands are called system binaries.


These system binaries are located inside this directory.


Take note that besides the system binaries that are located in the /bin directory there are also some binaries that are located inside the /usr directory.


/usr/bin which contains user executable commands


And


/usr/sbin which contains most commands that are used during system boot.


Also, the /usr/sbin directory contains commands that requires root privileges to execute.


/proc


This directory contains information about the current state of the running kernel.


This also includes details about the CPU, system memory, running processes, disks, file systems and networking.


Take note that the contents inside the /proc directory are created during system boot and saved in memory. These contents are updated during runtime, and will be deleted when your system is rebooted.

Next Topic Suggestion:

Introducing the Linux Shell

Category Suggestion

Recent Posts

Para sa Fresh Graduates, Trabaho Ba Agad? O Aral Ulit?
Basic Python : The print( ) Function
How to Install Python 3 on your Windows Computer
Basic Linux Commands: Moving Around Directories
Linux Command Syntax