2. The Linux File Hierarchy Structure or the Filesystem
Hierarchy Standard (FHS) defines the directory structure and
directory contents in Unix-like operating systems.
In FHS,
• all files and directories appear under the root directory /,
even if they are stored on different physical or virtual
devices.
Linux File Structure & Hierarchy
3. It is a Primary Hierarchy.The root
directory of the entire file system
hierarchy.
• Every single file and directory
starts from the root directory.
• The only root user has the right to
write under this directory.
• /root is the root user’s home
directory, which is not the same
as /
Linux File Structure & Hierarchy
1. / or Root
4. Essential command binaries that
need to be available in single-user
mode; for all users, e.g., cat, ls, cp.
• Contains binary executables.
• Commands used by all the
users of the system are located
here e.g. ps, ls, ping, grep, cp.
Linux File Structure & Hierarchy
2. /bin
5. Boot loader files, e.g., kernels, initrd.
• Kernel initrd, vmlinux, grub files
are located under /boot
Linux File Structure & Hierarchy
3. /boot
6. Essential device files, e.g. /dev/null. .
• These include terminal devices,
usb, or any device attached to
the system.
Linux File Structure & Hierarchy
4. /dev
7. Host-specific system-wide
configuration files.
• Contains configuration files
required by all programs.
• This also contains startup and
shutdown shell scripts used to
start/stop individual programs.
Linux File Structure & Hierarchy
5. /etc
8. Host-specific system-wide configuration files.
• Contains configuration files required by all
programs.
• This also contains startup and shutdown
shell scripts used to start/stop individual
programs.
Linux File Structure & Hierarchy
6. /home
9. Libraries essential for the binaries in
/bin/ and /sbin/.
Linux File Structure & Hierarchy
7. /lib
10. It shows removable media such as
CD-ROMs,USBs etc.
Linux File Structure & Hierarchy
8. /media
11. Temporary mount directory where
sysadmins can mount filesystems.
Linux File Structure & Hierarchy
9. /mnt
13. Essential system binaries, e.g., fsck, init,
route.
• Just like /bin, /sbin also contains
binary executables.
• The linux commands located under
this directory are used typically by
system administrator, for system
maintenance purpose.
Linux File Structure & Hierarchy
11. /sbin
14. Site-specific data served by this
system, such as data and scripts for
web servers, data offered by FTP
servers, and repositories for version
control systems.
Linux File Structure & Hierarchy
12. /srv
15. It is a directory that contains
temporary files created by the system
and users.
Files under this directory are deleted
when the system is rebooted.
Linux File Structure & Hierarchy
13. /tmp
16. Secondary hierarchy for read-only user data;
contains the majority of (multi-)user utilities
and applications.
It contains:
• /usr/bin –binary files for user program.
• /usr/sbin –binary file for system admins.
• /usr/lib- libraries for usr/bin and usr/sbin
• /usr/local – programs we install from
source.
• /usr/src – holds Linux kernel
sources,header- files and documentation.
Linux File Structure & Hierarchy
14. /usr
17. /usr/bin contains binary files for user
programs.
Linux File Structure & Hierarchy
14.1 /usr/bin
18. /usr/sbin contains binary files for system
administrators.
Linux File Structure & Hierarchy
14.2 /usr/sbin
20. /usr/local contains users programs that
we install from source. For example, when
we install apache from source, it goes
under /usr/local/apache2
Linux File Structure & Hierarchy
14.4 /usr/local
21. /usr/src holds the Linux kernel sources,
header files, and documentation.
Linux File Structure & Hierarchy
14.5 /usr/src
22. • Contains information about the system
process.
• This is a pseudo filesystem that
contains information about the running
process.
• This is a virtual filesystem with text
information about system resources.
Linux File Structure & Hierarchy
15. /proc
23. It is a temporary filesystem (tmpfs) that
stores volatile runtime data.
Linux File Structure & Hierarchy
16. /run