Linux directory structure
In order to understand Linux directory structure, you need to know 2 things:
First, in Linux, everything is a file. This means that software can interact with anything as if it was a file: interacting with hardware, with other programs, getting information about the system is implemented as reading or writing to files.
Second, Linux does not create a separate directory for each drive partition. Instead, partitions can be mounted anywhere in the directory structure. For instance, it is common to place /home
directory on separate partition.
Some specific details may vary across different Linux systems, but general layout is similar.
/bin
- binaries. This directory contains the software that can be used by all users. On most modern systems, it has been replaced with/usr/bin
, and/bin
is made a link to it for compatibility./boot
- contains files that are required for the system to boot: bootloader, kernel images and initial ramdisks./dev
- device files. Every device connected to the system is represented as a file in/dev
, and input/output operations are realized as reading and writing to device files./etc
- system-wide configuration files./home
- users' home directories. Each user has a home directory, where personal user data and user-specific configuration settings are stored./lib
- libraries. This directory contains libraries that are required for programs to run. On modern systems, it typically links to/usr/lib
./media
- external drives that are mounted automatically. On many Linux systems, this is replaced by/run/media
./mnt
- for manual mounting of exteral drives./opt
- optional. This is for manually installed software./proc
- processes. Contains information about processes that are running on the system./root
- root user's home directory./run
- runtime. Stores runtime information for software that starts early in the boot process. As mentioned earlier,/run/media
subdirectory is used on some Linux systems for mounting storage devices./sbin
- system binaries. Contains software that is only used by the root user. On most modern systems, this is a link to/usr/bin
or/usr/sbin
./srv
- used by web servers running on the system. On a desktop system running Linux, this will probably be empty./sys
- system. This directory contains files that are used as an interface to the kernel./tmp
- temporary. Stores temporary files that are deleted on shutdown or reboot./usr
- universal or Unix system resources. This directory contains software and other files that are installed by package manager./var
- variable. This directory contains files that are expected to change size during system operation, such as logs and caches.
Available as video here
2020/12/17