Filesystem
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.
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.
Directory | Contents |
---|---|
bin | Binary files for command execution |
boot |
Files for the boot loader |
dev |
Device files for interacting with devices connected to the system |
etc | System 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 |
opt | Optional application software packages |
proc |
Virtual filesystem for process and system information |
root | Home directory of root user |
run |
Run-time variable data since last boot |
sbin | System binary files for command execution |
srv |
Data for services provided by the system |
sys | Virtual directory for system information |
tmp | Temporary files |
usr |
Read-only user data for all
users; Some important subdirectories include:
|
var | Variable 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.