As we discussed previously, Linux has a hierarchical filesystem. The files and directories form a tree structure, in accordance with the Filesystem Hierarchy Standard (FHS). The topmost directory is the root directory / and all directories are contained within or below this directory in the hierarchy. There are several directories within the root directory – called subdirectories – that are generated upon installation of a Linux distribution. Many of these are used exclusively by the system. There are also some generated for use by users, where subdirectories can be created without elevated permissions.

Filesystem Tree Structure with the root at the top and various default directories at the second level as described below
A sample portion of the filesystem structure tree

The FHS includes descriptions of the core directories in the hierarchy, causing this structure to be relatively standard across Linux systems. The table provides a list of the major subdirectories of the root directory /. There is no need to remember the purpose of every directory unless you are working at a lower level within a Linux system. Rather, this table should give you an idea of the basic layout of a Linux filesystem and possibly serve as a useful reference in the future.

Based in part on content from Debian and up-to-date with FHS 3.0
DirectoryContents
binBinary files for command execution
boot Files for the boot loader
dev Device files for interacting with devices connected to the system
etcSystem configuration files
home User home directories
lib System shared libraries needed by binaries in bin and sbin
media Location for temporarily mounting filesystems from replaceable media
mnt Location for temporarily mounting filesystems
optOptional application software packages
proc Virtual filesystem for process and system information
rootHome directory of root user
run Run-time variable data since last boot
sbinSystem binary files for command execution
srv Data for services provided by the system
sysVirtual directory for system information
tmpTemporary files
usr Read-only user data for all users; Some important subdirectories include:
  • /usr/bin - program binaries
  • /usr/include - include files
  • /usr/lib - libraries for binaries in /usr/bin and /usr/sbin
  • /usr/local - local host data
  • /usr/sbin - Non-essential system binaries
  • /usr/share - shared data, such as documentation
  • /usr/src - kernel source code and headers
varVariable data

Most of the work you do will likely be performed in your home directory while on a Linux system, while programs you use will reside in other locations, as explained above. You may want to familiarize yourself with the Stampede3 Filesystem as well as how to navigate it if you are planning on doing work there. Also feel free to peruse Optional Topics in a later section for more information on the root user and mounts.

 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Inclusivity Statement