loader

Having good knowledge of the Linux file system and file structure is crucial for Linux administrators. Not only for knowing the program’s executable file’s location but for documentation. This post explains how the Linux file system organizes files and directories.

A Brief of File system definition

Linux system requires an organization method to store all files efficiently. The file system implements this method by creating and maintaining a manifest that locates each file’s place stored on the disk. To better understand, in windows, file system assigns a drive letter to each hard drive or partition, such as C and D. Therefore, users put these drive letters in the file location address or the commands.For example C:userssaraDownloadstst.txt. Linux uses the virtual directory structure to unify all hard drives and partitions into a single hierarchy directory structure.

The Virtual Directory

The root directory ‘/’ is the virtual directory’s foundation and the first directory. Other directories and subdirectories are under the root. First, unlike windows, Linux uses forward slashes; this is a big difference between Windows and Linux. Second, there is no drive letter in Linux. Every path starts from the root directory Therefore there is no clue to know which hard drive contains the file.

Linux virtual directory Linux file structure
Linux virtual directory structure
 

Mount Points

A mount point is a directory in the virtual directory that points to a specific hard drive. Mount points are like doors to the data stores. In the image below, “/” is the hard disk one’s mount point, and “/home” is the hard disk two’s mount point; in other words, the file system will store every file or directory under “/” on the hard disk one and every file and directory under “/home” on the hard disk two.

Linux Mount points
Linux Mount points

For example, a path to the messages file in the log directory will be like /var/log/messages. Even though /var is disk three’s mount point, it is not discoverable in the path. The first forward slash represents the root directory, as we mentioned before.

FHS – File Hierarchy Standard

Storing everything within the virtual directory is complicated. So FHS stands for file system hierarchy standard has been defined. FHS defines main directories and their location and their stored data types. Every Linux system should present main directories according to the FHS that are the same in all Linux operating systems. The following table contains standard FHS directories and their data type.

Directory

Description

/etc

The system, services, and applications configuration files

/boot

Boot loader files necessary for system boot

/var

Variable data files such as systems, services, and applications log files

/home

Users home directory

/usr

Standard Linux program files

In the following post we will explain Linux Shell commands.

2 Comment

  1. Pingback: LPIC1-003-Shell Surfing - SMEnode
  2. Pingback: LIPC1-008-Basic Commands - SMEnode Linux

Leave a Reply

Your email address will not be published. Required fields are marked *