Linux File system in Nutshell
The Linux file system is a hierarchical structure that organizes data on a Linux system. Here's a brief overview of key components and concepts:
Root Directory (/):
The top-level directory in the Linux file system.
All other directories and files are subdirectories or files of the root directory.
Directories:
Directories are folders that can contain other directories or files.
Common directories include
/bin
(binary executables),/home
(user home directories),/etc
(system configuration files), and more.
Files:
Files are stored within directories and can contain data or programs.
File names are case-sensitive in Linux.
Path:
A path is the location of a file or directory in the file system.
Absolute paths start from the root directory (e.g.,
/home/user/file.txt
).Relative paths are based on the current working directory (e.g.,
../documents/myfile.txt
).
File System Hierarchy Standard (FHS):
FHS is a standard that defines the directory structure and organization in Linux.
It helps maintain consistency across different Linux distributions.
/bin and /sbin:
/bin
contains essential user command binaries./sbin
holds binaries for system administration (usually for root).
/home:
User home directories are stored in
/home
.Each user typically has a subdirectory with their username (e.g.,
/home/user
).
/etc:
- Configuration files for the system and installed applications are stored in
/etc
.
- Configuration files for the system and installed applications are stored in
/var:
/var
contains variable data, such as logs (/var/log
), spool files, and temporary files.
/tmp:
/tmp
is a directory for temporary files that are cleared on system reboot.
/dev:
/dev
contains device files representing hardware devices (e.g.,/dev/sda
for the first hard drive).
/proc and /sys:
/proc
and/sys
provide information about kernel parameters and system hardware.
Mount Points:
Additional storage devices or partitions are mounted on directories.
For example, the
/mnt
directory can be a common mount point.
File Permissions:
Linux uses a permission system (read, write, execute) for files and directories.
Permissions are set for the owner, group, and others.
Symbolic Links:
Symbolic links (symlinks) are shortcuts or references to files or directories.
They can be created with the
ln
command.
This overview provides a nutshell view of the Linux file system. Understanding the structure is fundamental for navigating and managing files and directories in a Linux environment.