Explanation of Linux' Directory Hierarchy
There are a lot of new people to Linux in this forum, and for those who want to dig deeper into the system it might be useful to get a basic understanding of the Linux Directory Structure.
Slogan of the FHS:
"The filesystem standard has been designed to be used by Unix distribution developers, package developers, and system implementors. However, it is primarily intended to be a reference and is not a tutorial on how to manage a Unix filesystem or directory hierarchy." - FHS Homepage
Note: this is a pragmatic guide - suggestions are always welcome
cd / ; ls ; bin dev home mnt proc run tmp var boot etc lib media opt root sbin usr
The root directory - which is owned by the superuser. This is the "starting point" of all other directories in the system.
Unix system have (as opposed to Windows systems) only this one starting point (in Windows you have multiple drive letters). Everything is found below the root directory, no exceptions.
However, this does not mean there aren't any other drives / partitions - in Linux there simply all mounted within the directory hierarchy (for more details on this check /dev ).
Thanks to @lukimya
This directory contains binaries (i.e. executables) shipped with the kernel by default (for example ls or grep). These are extremely important for the usage of the system. You should never ever change anything in here.
Same as bin, however the execution of these binaries requires superuser-privileges.
This directory contains files necessary for the boot process, such as the boot loader, initial ramdisks etc.
Unless you really know what you're doing, you should never touch anything in here (especially on Embedded Devices this directory needs to be treated with extreme caution).
ls /boot; grub/ initramfs-linux.img memtest86+/ vmlinuz-linux
Under this directory you'll find all kinds of (software and hardware) devices (e. g. /dev/sdx for access to storage devices, /dev/random for random numbers etc.). This directory can be very useful for direct access to low level media.
Drives / Partitions
In /dev you'll also find all your drives (HDD, SSD, USB, ...). They are named as storage device roman-letter arabic-digit. The roman letter corresponds to the physical position of the storage device, the arabic digit to the partition on the storage device.
/dev/sda1 -> first partition on the first storage device /dev/sdc2 -> second partition on the third storage device
lsblk # list block devices
This directories contains a lot of configuration files (e.g. /etc/fstab) and subdirectories for individual applications (e.g. /etc/nginx/...). When configuring / debugging applications you should definitely have a look in here.
This directory contains the Home directories (i.e. home folders) of all users (except superuser). The individual subdirectories are owned by the corresponding users (e.g. /home/userx is owned by userx).
" ~/ " is an abreviation of the user directory.
Typically, the user directory holds the user's media (Pictures, Documents, Movies, Music et cetera), but also a lot of user-specific configuration files (e.g. for web browser). Most of the time these are hidden because they start with a dot (.). To view these directories, invoke the -A paramter when using ls:
ls ~/ -A .bash_history .bashrc .config/ Downloads/ Movies/ Pictures/
Libraries for default binaries (in /bin and /sbin). Libraries are essentially frameworks - they provide easier access / support to other applications.
Can be used as a directory for mounting other filesystems.
Can be used for mounting removeable media. However most Desktop Enviroments auto-mount these devices under /run/user/media.
The Kernel directory. The kernel writes a lot of information to this directory (e.g. /proc/meminfo or /proc/uptime) - therfore it is very useful for obtaining direct and fresh information about the system (again: low-level).
It can also be used to give the kernel instructions (e.g. CPU Governors on some ARM devices).
Optional software packages (not installed via package manager, sometimes closed-source packages)
Home directory of the superuser (usually not used, because you should not be logged in as superuser).
Information about processes running since last boot (e.g. process-id-files PID or lock files)
ls /run initramfs/ lock/ log/ mount/ network/ ssh.pid wpa_supplicant.pid
Direct access to RAM. By creating a file here, you are directly using your temporary system memory (very high speed and now wear-out). Data will be flushed on reboot.
This directory contains mostly variable files - such as application logs or cache (not in RAM).
Used for caching (temporarily storing) data on the PC. Commonly used by package managers ( such as APT or pacman ) to keep copies of the currently installed packages for backup purposes (e.g. in *.deb or *.rpm-format).
Variable data owned by games in /usr - I guess on the inside we all just really want to play...
Symbolic link to /run/lock/
Symbolic link to /run
Contains data which needs to be processed later on (e.g. print queues).
Same as /tmp (direct access to RAM), however data will be restored after reboot.
This directory is actually an almost exact replica of /. It is the so-called Secondary hierarchy.
Most important subdirectories are:
cd /usr ; ls ; bin lib local sbin share src
Contains almost all the packages / software installed on the system including applications provided by the Distribution (e.g. APT or pacman) and user-installed packages (installed via package manager).
Same as /usr/bin, however the execution of these binaries requires superuser-privileges.
Libraries for applications in /usr/bin and /usr/sbin
Same as /usr but contains self-compiled packages (and their data). Tertiary hierarchy.
This directories holds architecture unspecific files, mostly documentation / manual pages (used by the 'man' application).
Source code for applications (e.g. linux kernel).
More in depth explanation and differentiation:
ArchLinux Wiki: https://wiki.archlinux.org/index.php/Arch_filesystem_hierarchy
The Linux Documentation Project: http://tldp.org/LDP/intro-linux/html/sect_03_01.html (Thanks to @jereman1)
Man-Page of hier: http://linux.die.net/man/7/hier
Different Distributions may change these directories (or their usage) to vayring degrees - however this should be a general overview which should almost always apply.
If you have a question about any of these directories, go ahead and ask! (no troubleshooting please)
If you want to clarify / change / correct any of the above categories, go ahead and tell me!
EDIT 2015-03-17 Further differentiation and added links
EDIT 2015-03-16: Improved layout