File System in Linux

file system

Today, We will talk about file system in Linux. We are so late to discuss that as it is the first thing to learn for our new users. We will start it now without any more delay.

Here, File system refers to the structure of files and directories in Linux. It starts from ‘/‘.

“Image credit: Austinvernsonger, used under CC BY-SA 4.0 / Cropped from original.”

1. /

/ is called forward slash in English and in Linux people knows it with the name of root directory. Everything in Linux file system starts from ‘/‘. We can check all the directories by doing ls in / directory.

Key points for / directory are as follows:

Every file and directory comes under / directory.

Only root user can write in / directory.

2. /bin

/bin is a directory that contains essential command binaries that needs to be available for all the users like ls, cat, cp etc. bin stands for binary.

Key points for /bin directory are as follows:

Basic Linux commands you need to use are located in this directory.

These commands are fundamental for both users and system to interact with the OS.

3. /boot

/boot directory contains the files and data necessary to boot (start) the operating system.

Key points for /boot directory are as follows:

It holds the kernel, boot loader and related files that the system uses to initialize the operating system.

when a computer starts, the bootloader in /boot is responsible for loading the Linux kernel into memory and initializing the system.

4. /dev

/dev stands for device. Linux treats devices as files and /dev is where all the files are stored.

Key points for /dev directory are as follows:

/dev include terminal devices, USB or any device attached to the system.

Common names for storage devices: hard drives (/dev/sda, /dev/sdb), Partitions (/dev/sda1, /dev/sda2) etc.

5. /etc

/etc contains host specific system wide configuration files that is required by all programs.

Key points for /etc directory are as follows:

/etc directory stores text-based configuration files that are essential for system administration and operation.

Files in /etc generally apply to the entire system and affect all users. They often require root privileges to modify.

6. /home

/home stores personal files and directories for all the non root users.

Key points for /home directory are as follows:

Each user has a dedicated subdirectory within /home providing a private space for storing documents, files and other data.

Each user’s home directory is named after their username like /home/john, /home/love etc.

7. /lib

/lib directory stores essential shared libraries that are required by programs in /bin and /sbin.

Key points for /lib directory are as follows:

On 64-bit systems, /lib64 is used for 64-bit libraries, while /lib may still contain 32-bit libraries.

/lib contains static shared libraries.

8. /media

/media works as temporary mount point for removable media such as USB drives, CDs etc.

Key points for /media directory are as follows:

Designed specifically for removable media, providing a consistent location for users to access external storage devices.

Modern Linux systems automatically create subdirectories in /media for each connected device and mount the device there.

9. /mnt

/mnt directory works as designated location for temporarily mounting file systems for system administrators.

Key points for /mnt directory are as follows:

/mnt directory is used for temporarily mounting storage devices making their contents accessible to the file system.

/mnt is typically used for manually mounting devices or partitions.

10. /opt

/opt directory is used to store optional software and add-on packages that are not included by default in the operating system.

Key points for /opt directory are as follows:

Each software package installed in /opt is typically organized in its own subdirectory such as /opt/package-name.

Software in /opt is isolated from the rest of the system that helps in reducing the risk of conflicts with system-managed files or libraries.

11. /proc

/proc directory contains runtime system information (like processes, hardware details and kernel settings) and is dynamically generated by the kernel.

Key points for /proc directory are as follows:

The files in /proc are not stored on disk. Instead, they represent real-time data about the system.

/proc serves as an interface for users and applications to interact with the kernel.

12. /root

/root directory is the home directory for the root user. It is a private and secure area where the root user can store personal files, scripts and configurations that are not accessible by regular users.

Key points for /root directory are as follows:

Unlike regular users, who have home directories under /home/username, the root user’s home directory is located at /root.

The /root directory is only accessible by the root user and is protected to ensure security.

13. /run

/run directory in Linux is a temporary filesystem that holds runtime data for the system and applications.

Key points for /run directory are as follows:

/run used for storing files that are created during the system’s operation such as process IDs, sockets and other temporary information needed by running processes.

The contents of /run exist only while the system is running and are cleared on reboot.

14. /sbin

/sbin contains system binaries and administrative commands just like /bin.

Key points for /sbin directory are as follows:

These commands are essential for system management, booting, and repair that are typically restricted to the root or superuser for execution.

Many binaries in /sbin are critical during the system boot process as they help initialize the system.

12. /srv

/srv directory in Linux is used to store service-related data for servers. /srv stands for service.

Key points for /srv directory are as follows:

/srv contains data that is served or provided by system services like HTTP, FTP or other network services.

Subdirectories within /srv are typically named after the specific service or application they are associated with like /srv/http, /srv/ftp etc.

13. /sys

/sys directory acts as an API for interacting with the kernel and represents kernel objects, device drivers and hardware information.

Key points for /sys directory are as follows:

The contents of /sys change dynamically based on the hardware and configuration of the system.

/sys provides details about hardware devices and their associated drivers in a hierarchical format.

14. /tmp

/tmp contains temporary files created by system and users. Files in /tmp are typically deleted automatically after a system reboot or after a certain period of time depending on the system’s configuration.

Key points for /tmp directory are as follows:

It is writable by all users but individual files are usually protected from being accessed by other users due to appropriate permissions.

/tmp is meant for files that are not needed for long-term storage and can be recreated easily if removed.

15. /usr

/usr directory contains the majority of user-space applications, libraries and utilities necessary for running and managing the system.

Key points for /usr directory are as follows:

/usr stores shared read-only files for system-wide use such as applications, libraries and documentation.

/usr directory is not required during the initial stages of booting.

16. /var

/var directory in Linux stands for variable and is designed to store variable data files that change during the operation of the system. This includes logs, caches, spool files and other data that grows dynamically or changes frequently.

Key points for /var directory are as follows:

/var contains data used by both system services and user applications.

The contents of /var are constantly updated as the system runs.

That’s all for file system in Linux.

If you want to start Linux then download the ISO from here.

FAQ on File System for Linux

Q. What is the Linux File System?

A. The Linux File System is a standardized directory structure that organizes files and directories on Linux systems. It is defined by the Filesystem Hierarchy Standard (FHS) ensuring consistency across distributions.

Q. Why is the Linux filesystem hierarchical?

A. The hierarchical structure simplifies navigation, organization and management of files. It groups similar files into specific directories based on their purpose (e.g., system files, user data, configuration files).


Discover more from Root Learning

Subscribe to get the latest posts sent to your email.

Leave a Reply

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