File System Hierarchy (FSH) in Linux

·

3 min read

The File Sysytem Hierarchy (FSH) defines the directory structure and its contents in linux distributions.

When we look at the structure we come to see that every single directory or file is residing inside the parent **root ** ( / ) directory.

  1. / (Root) :
  • It is the primary hierarchy and root directory of the entire file system hierarchy.

  • Every single file and directory starts from the root directory .

  • Only root user has privilage to write under this directory .

  • /root ** is the root user's home directory , which is not same as / **directory .

  1. /bin (user binary) :
  • This directory contains essential command binaries that need to be available in single user mode for all users . Example cat , ls , cp .

  • It contains binary executables

  • Common linux commands that are used by local user of the system are located in this directory.

  • For example : ps , ls , ping , grep , cp , cat , ..etc.

  1. /boot :
  • This directory contains boot loader files e.g.., kernels , grub, grub2.

  • These files are necessary to boot the system such as Linux kernel.

  • Do not remove /boot directory as it will make system unbootable.

  • Kernels : initramfs , vmlinuz , grub files are located under /boot.

  • Example : initramfs-4.18.0-240.el8.x86_64.img vmlinuz-4..18.0-240.el8.x86_64

  1. /dev :
  • Contains files of essential device that are connected to the system .

  • This includes terminal devices , usb , hard disk , partition , pen drive , cd , dvd or any device attached to the system.

  • Example : /dev/tty1 , /dev/sr0 , /dev/sda1 , /dev/vda1

  1. /etc :
  • Contains configuration files requred by all programs .

  • This also contains startup and shutdown shell scripts used to start/ stop individual programs.

  • Example : /etc/resolve.conf , /etc/hosts , /etc/network-scripts/ifcfg-eth0.

  1. /home
  • Contains all local users home diectories.

  • Home directories for all local users to store their personal files.

  • Example: /home/samuel, /home/john, /home/rebecca

  1. /lib
  • The /lib directory contains those libraries that need to execute the binaries in /bin/ and /sbin/.

  • These shared library images are important for booting the system and executing commands of the root file .

  • Library file names are either ld* or lib.so.

  1. /media
  • It contains subdirectories used as mount points for removable devices such as CD-ROMS , Zip disks 3.5 diskettes.

  • Examples, /media/cdrom for CD-ROM, /media/cdrecorder for CD writer.

  1. /mnt
  • Contains temporarily mounted file systems.

  • Temporary mount directory where admins can mount file systems, or external storage devices ,such as NFS file system mounts.

  1. /opt
  • It contains optional application software packages.

  • Contains add-on applications from ndividual vendors .

  • Add-on applications should be installed in /opt or /opt/sub-directory.