Meaning of directories on Unix and Unix like systems

For more data on the layout of Linux file-systems, look at the Filesystem Hierarchy Standard (now at version 2.3, with the beta 3.0 version deployed on most recent distros). It does explain some of where the names came from:

  • /bin - Binaries.
  • /boot - Files required for booting.
  • /dev - Device files.
  • /etc - Et cetera. The name is inherited from the earliest Unixes, which is when it became the spot to put config-files.
  • /home - Where home directories are kept.
  • /lib - Where code libraries are kept.
  • /media - A more modern directory, but where removable media gets mounted.
  • /mnt - Where temporary file-systems are mounted.
  • /opt - Where optional add-on software is installed. This is discrete from /usr/local/ for reasons I'll get to later.
  • /run - Where runtime variable data is kept.
  • /sbin - Where super-binaries are stored. These usually only work with root.
  • /srv - Stands for "serve". This directory is intended for static files that are served out. /srv/http would be for static websites, /srv/ftp for an FTP server.
  • /tmp - Where temporary files may be stored.
  • /usr - Another directory inherited from the Unixes of old, it stands for "UNIX System Resources". It does not stand for "user" (see the Debian Wiki). This directory should be sharable between hosts, and can be NFS mounted to multiple hosts safely. It can be mounted read-only safely.
  • /var - Another directory inherited from the Unixes of old, it stands for "variable". This is where system data that varies may be stored. Such things as spool and cache directories may be located here. If a program needs to write to the local file-system and isn't serving that data to someone directly, it'll go here.

/opt vs /usr/local

The rule of thumb I've seen is best described as:

Use /usr/local for things that would normally go into /usr, or are overriding things that are already in /usr. Use /opt for things that install all in one directory, or are otherwise special.


Sorry to resurrect an old thread, but I feel this detail is an important clarification for all future seekers of this info:

  • /opt stands for optional (as in optional add-on packages).
  • /bin stands for binary (contains executables used by the OS).
  • /lib stands for library (contains shared libraries used by filesystem and for booting, probably used by the executables in bin)
  • /proc stands for processes.
  • /root means root user.
  • /home holds the home sub-directories for any non-root users.
  • /dev stands for device (holds special and device files).
  • /tmp stands for temporary.
  • /srv stands for serve.
  • /mnt stands for mount point (mount a temporary filesystem here).
  • /include contains #include files, i.e. header files (e.g., stdio.h).
  • /var stands for variable
  • /etc stands for etcetera

  • /usr stands for Unix System Resources(Source)


Historically, /etc stands for "etcetera" and /var is short for "variable." I suppose the former is because a large collection of unrelated system configuration files go into /etc. The latter is because the files in /var are expected to change. You can often mount /usr and / as read-only (except when performing updates), but you can never mount /var read-only. It hold system logfiles, lock files, spool files, and other things that change dynamically.

Other people gave you pointers to help you figure out what best goes where.


Try this:

$ man hier

The best place to look for this is the Filesystem Hierarchy Standard (FHS). The latest version is 2.3 available at: http://www.pathname.com/fhs/pub/fhs-2.3.html.