What I Learned Today 💡 June 7, 2017
Review of 24 Directories from Linux FHS
I don’t have much time today, so I thought I’d just review the 24 directories I’ve covered from the Linux Filesystem Hierarchy Standard.
/: Root Directory. Beginning of the Filesystem Hierarchy.
/bin: Essential binaries. There must be sufficient binaries in this directory such that the system can function properly in Single User Mode, where only
/is mounted. The binaries in
/usr/local/bin(probably) won’t be available, so
/binmust be sufficient. Examples:
/boot: Files needed @ boot time. The Linux Kernel (vmlinuz), the Initial RAM Disk Image (initrd), Boot-loader (grub is one).
/dev: Device-files for the various devices connected to the system.
/etc: Configuration files for system-wide settings. Used to be a dumpster for files that didn’t belong elsewhere — hence its namesake: Etcetera. Examples:
/etc/passwd(user and system-account information),
/home: Home directories for user-accounts.
/lib: Shared libraries for common system tasks.
/lost+found: Data recovered from a filesystem corruption event.
/media: Modern Linux. Mount points for removable media mounted automagically @ insertion.
/mnt: Old Linux. Mount points for removable media mounted manually.
/opt: Optional software. Typically only used by 3rd party, commercial software that “does not behave well.”
/proc: “Peephole into the Kernel for current processes”. Each currently-running process on the system has a directory here. Within each directory is the respective process’s data-structures within the Kernel. I really don’t know much about this directory, so I’ll just stop talking about it.
/root: Home directory for root user.
/sbin: Sys-admin binaries.
/tmp: Temporary, transient files. On some configurations, this directory is emptied on reboot.
/usr: *Secondary File Hierarchy.* Contains READ-ONLY data intended for system-wide use. Usually the largest directory tree on a Linux system.
/usr/bin: Non-essential binaries. These binaries are managed by the operating system. They are either included with the operating system by default, or they are installed via package manager. Often, this directory holds thousands of programs.
/usr/lib: Shared libraries for the programs in
/usr/local: *Tertiary File Hierarchy.* Contains custom, non-standard data that is local to this machine. For example, you would put custom programs compiled from source in
/usr/local/bin. This contains directories that mirror
/usr/sbin: Non-essential sys-admin binaries.
/usr/share: Shared assets such as sound files, icons, config files, etc.
/usr/share/doc: Documentation for various packages.
/var: For variable data. Unlike most of the other directories, which are strictly read-only,
/varis for data that is likely to change, such as databases, spool files, and user email.
/var/log: Logs from system-activities. You should monitor this occasionally.
Opinions expressed in these articles do not reflect those of my employer.