In this post, I would like to touch on the Linux directory structure and the purpose and function behind each directory. As you probably already know, / (root) is the highest level directory and everything exists beneath it. The functions of some things like /home and /boot are pretty obvious, but what about /proc or /etc? No worries! I’ll show you!
This is the root directory itself. All files and directories exist under this directory. An important point to note is that the sub-directories under root may not actually be on the same partition or even disk, this is just the organizational structure.
This directory stores the most critical programs, or binaries (hence /bin) that the system needs to operate. Both the most common shells (dash, bash) reside here, along with a lot of the “base” commands you encounter (cp, df, grep, ln, ls, rm, etc.).
Note that the directory /usr/bin contains binaries as well. This directory is usually more user-oriented and contains applications (gimp, gthumb, inkscape, vlc, wine, etc.) along with other binaries (id, lshw, make, top, wget)
This is the place where the, duh!, the boot files are stored. A simple directory listing here will show you things like memtest86+ (a memory testing utility installed with many distributions), vmlinuz (the Linux kernel), and grub (or lilo, two of the most common and prevalent bootloaders)
This contains all the devices (note that devices are treated as files in Linux) that are accessible by the Linux filesystem. It is typically automatically populated at boot by Udev.
The configuration files for the Linux filesystem are stored here. For example, /etc/ssh/sshd_config and /etc/samba/smb.conf contain the configurations for SSH and Samba respectively.
This directory contains the personal files (Desktop, Documents, Music, Pictures, Videos, etc.) for each of the users, at /home/<username>.
Dynamically linked shared libraries reside in this directory. If you are coming from a Windows background, the items in here are very similar to DLLs you’d find at (C:\Windows\System32 or C:\Windows\SysWOW64)
Same as /lib but this directory contains 64bit libraries.
The lost+found directory contains files that have been restored after a system crash or filesystems that were not dismounted cleanly.
Removable filesystems such as cd-roms, floppys and flash drives are mounted here.
“Permanently” mounted filesystems are mounted here. This typically includes partitions, internal drives and manually added contents from /etc/fstab.
This directory is for optional software packages and files.
This is a special virtual directory in which running processes (numbered) are located as well as entries that configure the running system (named).
This is a temporary filesystem which stores volatile runtime data.
This directory is similar to /bin, except that the majority of the binaries that reside here require root access (i.e. sudo) in order to be run (blkid, fdisk, mkfs, mount, shutdown, etc.).
Note that the directory /usr/sbin contains binaries as well, but like /sbin, they typically require root access (chroot, groupadd, update-grub, useradd, etc.).
In here, site-specific data for the system in stored. Services such as http. ftp, rsync, www and cvs are stored here.
This directory is a virtual filesystem which stores and allows modifications to devices.
Temporary files create by programs are stored in this directory.
This directory contains items that pertain to the system users such configuration files and graphics (/usr/share), source code (/usr/src), C/C++ headers (/usr/include) and shared libraries (/usr/lib)
This directory contains files that change as the system is running. A few notable items are the system log files (/var/log), incoming and outgoing mail (/var/mail), and printer spools (/var/spool).