Back to blog index.

Linux Directory Structure

I often find myself forgetting Linux’s directory structure and its cryptic names, so this document serves as a quick reference for me. Who knows, maybe someone else will find it useful as well?

Heads up: (vfs) indicates that the directory is a virtual file system and does not contain “real” files. I didn’t verify all of the vfs marks, though, so do your own research.

(Also, you can interpret “binaries” as executables or programs.)

directory naming justification extra notes  
/usr user binaries    
/bin binaries    
/sbin system binaries (for sysadmins)  
/lib shared libraries (for binaries to use)  
/opt optional third-party binaries    
/home users’ home directories (default current directory)  
/root root user’s home directory    
/boot bootloader files (kernels, initrd)  
/etc configuration files (for system, services)  
/srv server files (HTTP, FTP services)  
/var variable data (log files, print queues)  
/tmp temporary files (usually cleared on reboot)  
/mnt mounted file systems    
/proc running processes   (vfs)
/sys sysfs (device/driver info) (vfs)
/dev devices (disks) (vfs)
/media media devices (removable media, USBs) (vfs)

Of course, there are more directories, but these are the basic ones you should know, and any more involved directories (such as /lost+found, /run) can be googled by you.

extra notes

The distinction between /usr, /bin, /sbin, /lib, and /opt is muddied and I don’t really understand it. As with most decade-old+ software, a lot of the ambiguity has to do with historical reasons. Here’s a good discussion I found on the matter.

must be on root partition:

must be on same partition:

make a separate partition for:

also recommended to make a partition for: