On Linux, everything on the system is represented with a file---Keyboards, disk drives, robotic arms, running programs and the rest: All files. Naturally, a Linux system needs a lot of files---And a sensible way to organize them.
The File Hierarchy Standard (FHS for short) is the generally agreed upon way of organizing the files of a Linux system. I say "generally" because some systems do deviate here and there. Thus follows an outline of the FHS with some notes about those little idiosyncrasies in the form of a bulleted list. Each item represents a directory containing the items tabulated ahead of it.
-
/"Root" Everything on the system.-
/binEssential binaries (Sometimes a link to/usr/bin). -
/bootBoot loader files. -
/devDevice files. -
/etcSystem-wide configuration files. -
/homeNon-root user directories.-
/home/your-user-nameYour user directory.
-
-
/libEssential libraries (Sometimes a link to/usr/lib). -
/mediaMount points for removable media (Alternatively,/run/media). -
/mntTemporarily mounted file systems. -
/optOptional application files (Standalone installers may use this). -
/procProcess and kernel information files. -
/rootHome directory of the root user. -
/runRun-time data since last boot. -
/sbinEssential system binaries (Sometimes a link to/bin). -
/srvData served (vis á vis HTTP, FTP, etc.) by the system. -
/sysInformation about devices, drivers, and kernel features. -
/tmpTemporary files. Your browser may cache web pages here. -
/usrRead only user data: Applications and their libraries, mostly.-
/usr/binUser application binaries. -
/usr/libUser application libraries. -
/usr/includeDevelopment headers. -
/usr/shareNon-instruction user application files. -
/usr/localThird-party user applications data.
-
-
/varFiles expected to change frequently, caches, logs, spools, etc.
-
In your Linux journey, you may encounter all manner of unusual file system choices. GoboLinux, for instance, makes a distinct hierarchy for each program! And NixOS completely eschews the FHS in favor of modularity. We won't worry about all that here though. For the most part, Linux operating systems stick to the FHS. Where they do not, the variations are either slight or rigorously documented.
Top comments (1)
This information is invaluable. Thanks for the post!