Linux Filesystem Hierarchy Structure

Linux filesystem hierarchy known as Filesystem Hierarchy Standard (FHS) is describing the directories and the directory contents in a Unix system. In Linux Filesystem all the files and directories are available under / (slash) root directory. In Linux / (slash) is the starting point of the all files or directories. Most of the Unix like systems have this Filesystem structure.

Linux Filesystem directory structure:

Linux filesystem starts with / (slash)

/: Primary root directory of the entire Linux filesystem hierarchy

/bin: All the required command binary files that needs to be available for single-user mode are in this directory.

Binary files available in this directory are bash, base64, bc, cd, cat, curl, chmod, chown, date, dir, dos2unix, dmesg, echo, env, find, free, firefox, getconf, grep, groups, hostname, hostnamectl, head, journalctl, kill, ls, less, locate, lsattr, lsblk, lscpu, man, md5sum, mkdir, mount, mv, nano, nc, ncat, nice, nslookup, nmtui, nmcli, netstat, openssl, perl, ping, pip3, pkill, ps, pwd, python3, quota, rename, renice, rm, rmdir, rpm, rsync, scp, ssh, sed, sftp, sh, sort, sudo, su, systemctl, tee, top, tty, tracepath, tr, tree, ulimit, uname, umask, uniq, unzip, uptime, vi, vim, wait, wc, wget, which, who, whoami, yum, zcat, zegrep, zgrep, zip.

/boot: In this path we have boot loader files like kernels, initrd etc which are used to boot the operating system

Files and directories in this path are efi, grub2, loader, vmlinuz-4.18.0-305.3.1.el8.x86_64, initramfs-4.18.0-305.3.1.el8.x86_64.img.

/etc: This directory contains all the server wide configuration files which are used by all the installed applications and system applications.

Some of the configuration files available in this directory is bashrc, Bluetooth, centos-release, crontab, dhcp, dnf, exports, fstab, hostname, hosts, motd, netconfig, networks, nfs.conf, passwd, resolv.conf, sudoers, sysctl.conf, yum.conf

/home: It is the home directory for all the users created in Linux. In this directory all the users files and settings will be stored.

/lib: This directory contains the library files which being used by the binaries available in /bin and /sbin

Directories inside the lib are cups, debug, environment.d, firewalld, firmware, grub, kernel, modules, NetworkManager, ostree, rpm, sysctl.d, systemd, tmpfiles.d

/lib64: This directory contains the alternate essential binaries which are used on system which supports more than one executable format.

/media: All the removable media like pendrives and CD-ROM devices will be mounted in this path.

/mnt: This directory is used to mount the temporary filesystems mostly from remote machines.

/opt: All the third party applications or add-on application packages which are being installed by the user will be installed in this directory.

/proc: It is a virtual filesystem in Linux providing process and kernel information as files. In this path all the files populated automatically or generally available.

/root: This is the home directory for the root user. All the root user configurations are available in this path.

/run: This directory contains the details like run time variables data and the information about all the running process, currently logged-in user details, system last boot details.

The run files for all the applications in this directory are avahi-daemon, console, cups, dbus, firewalld, faillock, fsck, initramfs, lock, log, lvm, media, rpcbind, samba, systemd

/sbin: This the essential directory for the system binary files like init, fsck, route

/srv: In this directory site specific data, scripts for web servers, ftp services data and version control systems repositories are available.

/sys: This directory contains the details about the devices, drivers and kernel feature details.

Directories inside this path are block, bus, class, dev, devices, firmware, fs, hypervisor, kernel, module, power

/tmp: In this directory we can store temporary files. Some of the applications also store application temporary data in this path. Data stored in this path might not be available on server reboots based on the configuration.

/usr: This directory contains read-only user data, multi-user utilities and applications. Directories inside this path are bin, games, include, lib, lib64, libexec, local, sbin, share, src, tmp

/var: All the variable files which are continuously changing during the application run on the system. It contains all the application log files, spool files, temporary files etc.

Directories inside this path are account, adm, cache, crash, db, empty, ftp, games, gopher, kerberos, lib, local, lock, log, mail, nis, opt, preserve, run, spool, tmp, yp

Common Filesystem types:

Below are the common filesystems across the multiple operating systems.

ext – It is an extension of the minix filesystem. It has been replaced by ext2 files system which is newer version of this filesystem in kernel 2.1.21

ext2: It is having high performance in terms of disk and removable media used in Linux

ext3: This is the upgraded version of ext2 where journaling version feature has been implemented. In this filesystem we can easily switch between ext2 and ext3

ext4: This is upgraded version from ext3. This filesystem contains high performance, reliability enhancements, increase volume to large sizes and directory size limits.

hpfs: It is the high performance filesystem used in OS/2. It is a read-only filesystem in Linux

iso9660: It is a CD-ROM filesystem to use by the disk type media.

JFS: It is called journaling file system developed by IBM. It is available in Linux kernel from 2.4.24 kernel version.

minix: It is the first filesystem used to run in Linux. This file system is used in minix operating system.

msdos: This filesystem is being used in DOS, Windows and OS/2 systems.

ncpfs: It is the network filesystem which is using NCP protocol.

nfs: This is network file system used to access the disk available in remote storage devices or remote machines.

ntfs: It has replaces Microsoft windows filesystem (FAT, FAT32). It has reliability, performance, space-utilization, ACL options, encryption, journaling etc

proc: It is a pseudo filesystem which is used as an interface to kernel data structures.

Reiserfs: It is a Journaling file system designed by HansReiser. It was integrated to Linux kernel in 2.4.1 kernel version

smb: It is network filesystem which uses SMB (protocol). By using this filesystem type we can mount windows partitions in Linux servers.

vfat: It is the extended FAT filesystem for Microsoft windows95 and Windows NT operating systems. In this filesystem we can use long filenames under MSDOS filesystem.

XFS: It is a journaling filesystem which was integrated to Linux in kernel 2.4.20 version

For more information on Linux filesystems for Redhat based operating systems please visit official documentation here.

Leave a Comment