This blog file contains everything you need to know about Linux’s filesystem: how it works, what each directory does, and more.
Linux is a powerful operating system that many people depend on to keep their computers running. Linux has been around for over 30 years and was created by Linus Torvalds in 1991. Linux is one of the most popular operating systems in the world, with about 10% of all desktop users using it. Linux also powers many servers and mobile devices! The Linux filesystem can be difficult to understand at first, but once you learn how it works, you will appreciate its complexity and power.
/ is the root directory, which contains all other directories. The /usr directory stores user applications and files, while the /var directory stores system logs, mailboxes, and other data.
Linux also has a hidden filesystem that starts with a / character. This hidden filesystem is used to store sensitive information such as passwords and configuration files. By default, Linux does not show the hidden filesystem to users, but you can enable it by bypassing the “show_hidden” parameter to the mount command.
Linux Directory Structure
The Linux filesystem is a hierarchical file system. Linux has the capabilities to create, delete, rename files and directories, change permissions through Linux access control lists, set Linux file attributes on individual files, create hard and symbolic links to files, obtain file timestamps.
The Linux directory structure includes Linux subdirectories or Linux folders which are also known as Linux Directories. Linux file system hierarchy has a tree structure. It contains Linux files and directories, also known as Linux folders or Linux subdirectories with the root directory called “/” which is abbreviated as “rootfs” in Linux kernel source code.
Linux operating systems are based on UNIX-like filesystems where all user home directories are placed in a single directory tree, typically exported as the Linux home directory. The Linux root user’s home directory is “/root” and it is a symbolic link to the real home directory which can be found in “/home/username”.
The Linux filesystem consists of files that are placed in directories. Directories are similar to folders in Windows operating systems.
Linux Root Filesystem
The Linux root filesystem contains all of the directories and files that are necessary to run Linux. It’s divided into several main directories, including /bin, /dev, /etc, and /lib. Each of these directories contains important files and directories that allow Linux to function properly.
For example, the /bin directory contains essential Linux binaries, while the /etc directory contains important configuration files. The /lib directory contains shared libraries that are used by Linux applications.
It’s important to understand the structure of the Linux root file system because Linux is based on a directory structure. This file system layout will be familiar to anyone who has experience using Linux, and it’s something that you should know before starting Linux-based tasks or working in the Linux environment.
Below are most of the Linux root filesystem directories
- /: Root directory
- /bin: Contains command binaries
- /boot: Boot loader location
- /dev: Device files: nodes to the device equipment, a kernel device list.
- /etc: contains important configuration files
- /home: The user’s home directory
- /lib: Stores shared libraries and kernel modules
- /media: Mount point for external devices like USB drives
- /mnt: Mount point for mounting a filesystem
- /opt: Location for optional software
- /proc: A virtual filesystem that is managed by the Linux kernel
- /sbin: Stores system binaries
- /srv: Data for services provided by this system
- /tmp: Location for temporary files and folders
- /usr: Contains user programs
- /var: Stores variables data and log files