Introduction
- Linux originally had no standard file system structure.
- Understanding the Linux file system structure is crucial for navigation and control.
- The Filesystem Hierarchy Standard (FHS) provides a consistent directory structure.
- Linux distributions may add custom tweaks to the FHS.
Notes
- usr stands for Unix System Resources, not user.
- Use the PATH variable to specify default binaries.
- The PATH variable can be reordered to specify default binaries.
- Use LD_LIBRARY_PATH to tweak the library search order.
- Keep user data in /home and admin data in /root.
- /run is used by system services for ongoing communication.
- Regularly inspect /var/log for hardware events and security issues.
- /proc and /sys are useful for performance tuning and forensic triage.
- /bin, /usr/bin, and /usr/local/bin serve as homes for different types of executables.
- /lib and /usr/lib hold shared libraries essential for binary functionality.
The hierarchy
/bincontains core OS programs (base OS binaries) accessible before /usr mounts./usr/binis the primary home for non-base OS binaries./usr/local/binholds executables installed by admins from source./sbindirectory house sysadmin utilities requiring root access./liband/usr/libcontain shared library files for binaries./libcontains shared library files essential for /bin and /sbin binaries./usr/libholds libraries for /usr binaries not critical for early system init./etccontrols services with configuration files./homestores user data, while/rootis exclusive to administrators./varstores fast-changing data like logs and caches./runcontains volatile run-time info like systemd details./procand/sysprovide system observability and configuration./procis oriented towards process/runtime statistics./sysprovides component/hardware access for monitoring and config.devdevice filestmptemporary filesbootboot loader filesoptoptional applicationsmntmount directorymediaremovable devicessrvservice data