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.-
/bin
Essential binaries (Sometimes a link to/usr/bin
). -
/boot
Boot loader files. -
/dev
Device files. -
/etc
System-wide configuration files. -
/home
Non-root user directories.-
/home/your-user-name
Your user directory.
-
-
/lib
Essential libraries (Sometimes a link to/usr/lib
). -
/media
Mount points for removable media (Alternatively,/run/media
). -
/mnt
Temporarily mounted file systems. -
/opt
Optional application files (Standalone installers may use this). -
/proc
Process and kernel information files. -
/root
Home directory of the root user. -
/run
Run-time data since last boot. -
/sbin
Essential system binaries (Sometimes a link to/bin
). -
/srv
Data served (vis á vis HTTP, FTP, etc.) by the system. -
/sys
Information about devices, drivers, and kernel features. -
/tmp
Temporary files. Your browser may cache web pages here. -
/usr
Read only user data: Applications and their libraries, mostly.-
/usr/bin
User application binaries. -
/usr/lib
User application libraries. -
/usr/include
Development headers. -
/usr/share
Non-instruction user application files. -
/usr/local
Third-party user applications data.
-
-
/var
Files 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!