Study guide
8.6 Filesystem Hierarchy Standard (FHS) & File Location (104.7)
LPIC-1 Linux Administrator — Exam 101 101-500
Track your progress as you read
Finished sections get a check mark.
1 Exam Overview & Study Strategy
1.1 LPIC-1 101-500 Exam Structure & Blueprint 1.2 Command Line & Shell Fundamentals for Exam Success 1.3 Fill-in-the-Blank Strategies & Common Traps
2 Topic 101: System Architecture
2.1 Hardware Discovery, Sysfs, Procfs & Kernel Modules (101.1) 2.2 Udev, Dbus & Device Management (101.1) 2.3 BIOS vs. UEFI & System Boot Process (101.2) 2.4 Kernel Initialization, Initramfs & System Logs (101.2) 2.5 Systemd Boot Targets & Unit Management (101.3) 2.6 SysVinit Runlevels, Telinit & System Shutdown (101.3)
3 Topic 102: Linux Installation & Boot Management
3.1 Hard Disk Layout, Partition Schemes & Swap Design (102.1) 3.2 LVM & Standard Mount Point Allocation (102.1) 3.3 GRUB 2 Configuration & Troubleshooting (102.2) 3.4 Legacy GRUB & Alternative Boot Loaders (102.2) 3.5 Managing Shared Libraries & ldconfig (102.3) 3.6 Linux as a Virtualization Guest & Cloud Instances (102.6)
4 Topic 102: Package Management Systems
4.1 Debian Low-Level Package Management with dpkg (102.4) 4.2 High-Level Debian Package Management: apt, apt-get & apt-cache (102.4) 4.3 RPM Package Management with rpm (102.5) 4.4 YUM, DNF & Zypper Package Management (102.5) 4.5 Package Repositories & Integrity Verification (102.4/102.5) 4.6 Universal Linux Packages: Snap, Flatpak & AppImage (102.4/102.5)
5 Topic 103: Command Line & Text Processing
5.1 Shell Environment, Environment Variables & Aliases (103.1) 5.2 Command History, Quoting & Expansion (103.1) 5.3 Basic Text Filters: cat, head, tail, cut, paste, nl, od (103.2) 5.4 Advanced Text Filters: sort, uniq, wc, tr, split, less & Checksums (103.2) 5.5 Stream Editing with sed (103.2) 5.6 Basic File Management: cp, mv, rm, touch, mkdir, rmdir (103.3) 5.7 Archiving and Compression: tar, gzip, bzip2, xz, cpio & dd (103.3)
6 Topic 103: Streams, Processes, Regex & Vi
6.1 Standard Streams, Redirection & File Descriptors (103.4) 6.2 Pipelines, tee & xargs (103.4) 6.3 Process Monitoring: ps, top, free, watch, pgrep, pstree & uptime (103.5) 6.4 Signals, kill, Job Control, nohup, screen & tmux (103.5) 6.5 Process Priorities: nice & renice (103.6) 6.6 Regular Expressions & grep, egrep, fgrep (103.7) 6.7 vi / vim Modes, plus nano, Emacs & EDITOR Awareness (103.8)
7 Topic 104: Devices, Partitions & Filesystems
7.1 Block Devices, fdisk & gdisk (104.1) 7.2 GNU Parted & Partition Table Management (104.1) 7.3 Creating Filesystems: mkfs, ext4, XFS, VFAT/exFAT & Btrfs (104.1) 7.4 Filesystem Integrity: fsck, e2fsck, xfs_repair, xfs_fsr & xfs_db (104.2) 7.5 Monitoring Disk Usage: df, du & tune2fs (104.2) 7.6 Managing Swap Space: mkswap, swapon & swapoff (104.1/104.2)
8 Topic 104: Mounts, Permissions, Links & FHS
8.1 Mounting and Unmounting Filesystems: mount & umount (104.3) 8.2 Persistent Mounts: /etc/fstab, UUIDs & systemd mount units (104.3) 8.3 Standard File Permissions: chmod, chown, chgrp & umask (104.5) 8.4 Special Permissions: SUID, SGID & Sticky Bit (104.5) 8.5 Hard Links vs. Symbolic Links: ln & Inodes (104.6) 8.6 Filesystem Hierarchy Standard (FHS) & File Location (104.7)
8.6 Filesystem Hierarchy Standard (FHS) & File Location (104.7)
Key Takeaways Explain This Topic AI
The Filesystem Hierarchy Standard (FHS 3.0) specifies the standard directory structure and file locations across all Unix-like and Linux operating systems to ensure software portability and administration consistency.
Key FHS root directories include /etc (host-specific static configuration files; contains NO binaries), /boot (static bootloader files and kernels), /opt (third-party add-on software packages), /srv (site-specific service data), and /var (variable files such as logs, spool, and cache).
Real-time recursive filesystem searching is conducted using find , which searches live storage using extensive filter predicates ( -name , -type , -size , -mtime , -perm , -user ) and actions ( -exec , -delete , -print0 ).
Fast indexed pattern searching is provided by locate , which queries a precompiled database ( /var/lib/mlocate/mlocate.db or /var/lib/plocate/ ) updated via the background utility updatedb (configured in /etc/updatedb.conf ).
Command identification tools serve distinct functions: which locates executables in $PATH , whereis finds binaries, man pages, and source files, and type (a Bash builtin) determines whether a command is a shell builtin, alias, function, keyword, or external executable.
Last updated: August 2026
8.6 Filesystem Hierarchy Standard (FHS) & File Location
Quick Summary: The Filesystem Hierarchy Standard (FHS) defines the standard directory structure and content requirements for Linux systems, ensuring interoperability between distributions and third-party software. Locating files, binaries, libraries, documentation, and configuration settings within this hierarchy requires a dedicated command toolkit: find performs deep, real-time filesystem traversal; locate performs fast indexed lookups against precompiled databases generated by updatedb ; which searches the user's $PATH ; whereis finds binaries, manual pages, and source trees; and type identifies shell builtins, aliases, and functions. Both FHS directory definitions and file search utilities are central to LPIC-1 Topic 104.7.
1. Filesystem Hierarchy Standard (FHS 3.0) Overview
The FHS categorizes directories along two primary axes:
Shareable vs. Unshareable: Shareable files can be stored on one central host and accessed over the network by multiple clients (e.g., /usr , /opt , /srv ); unshareable files contain host-specific data (e.g., /etc , /boot , /var/log ).
Static vs. Variable: Static files remain unchanged without administrator intervention (e.g., /bin , /lib , /usr/bin ); variable files are continuously modified by running daemons and users (e.g., /var/log , /var/spool , /tmp , /run ).
Comprehensive FHS Directory Reference Table
Directory Classification FHS 3.0 Standard Description & Requirements
/ Unshareable / Static Root directory. The top of the unified directory tree; must contain all files essential to boot, repair, and restore the system.
/bin Shareable / Static Essential user command binaries required for single-user mode and system recovery (often a symlink to /usr/bin in modern distros).
/sbin Shareable / Static Essential system administration binaries required for boot and recovery (e.g., fsck , init , fdisk ; often a symlink to /usr/sbin ).
/boot Unshareable / Static Static files of the bootloader (GRUB config), Linux kernel images ( vmlinuz ), and initial RAM disk images ( initramfs ).
/dev Unshareable / Static Device nodes representing physical and virtual hardware components, dynamically populated by udevd .
/etc Unshareable / Static Host-specific system-wide configuration files. FHS strictly mandates that /etc must contain NO executable binaries .
/home Shareable / Variable User home directories containing personal user data, profiles, and configurations.
/lib , /lib64 Shareable / Static Essential shared libraries required by binaries in /bin and /sbin , and loadable kernel modules ( /lib/modules/ ).
/media Unshareable / Variable Mount points for removable media (e.g., /media/cdrom , /media/usb ).
/mnt Unshareable / Variable Temporarily mounted filesystems used by administrators for manual repair or maintenance.
/opt Shareable / Static Add-on application software packages. Reserved for self-contained, third-party software (e.g., /opt/google/chrome , /opt/gitlab ).
/proc Unshareable / Variable Virtual pseudo-filesystem providing an interface to kernel data structures and process metrics.
/root Unshareable / Variable Home directory for the root superuser account (separated from /home to ensure availability if /home fails to mount).
/run Unshareable / Variable Runtime variable data since last system boot (e.g., daemon PID files, UNIX domain sockets); mounted as tmpfs .
/srv Shareable / Variable Site-specific data served by this system (e.g., web server data /srv/www , FTP data /srv/ftp ).
/sys Unshareable / Variable Virtual pseudo-filesystem exposing the kernel device driver model and hardware subsystem parameters ( sysfs ).
/tmp Unshareable / Variable Temporary files; may be cleared automatically on reboot or by automated cleanup utilities.
/usr Shareable / Static Secondary user hierarchy. Contains the bulk of read-only user utilities and applications.
/var Unshareable / Variable Variable data files. Data that changes dynamically during normal operations (logs, mail spools, caches).
- 2. Key FHS Subdirectories & Exam Hotspots
- 1. The /usr Subhierarchy
/usr/bin : Primary directory for non-essential executable commands.
/usr/sbin : Non-essential system administration binaries.
/usr/lib , /usr/lib64 : Shared libraries for binaries in /usr/bin and /usr/sbin .
/usr/local : Tertiary hierarchy used by system administrators for locally compiled software installed without package managers (e.g., /usr/local/bin , /usr/local/etc ).
/usr/share : Architecture-independent shared data (icons, fonts, timezone data).
/usr/share/man : Standard location for system manual pages ( man ).
/usr/share/doc : Application documentation and release notes.
/usr/src : Kernel and application source code.
2. The /var Subhierarchy
/var/log : System and daemon log files (e.g., /var/log/messages , /var/log/syslog , /var/log/journal ).
/var/spool : Queued application data waiting for processing (print queues, mail spools, cron jobs in /var/spool/cron ).
/var/cache : Application cache data (e.g., apt package cache, dnf metadata).
/var/lib : Dynamic state information maintained by applications (e.g., package manager databases, database storage).
/var/tmp : Temporary files that must be preserved across system reboots (unlike /tmp , which may be cleared on boot).
3. Real-Time Searching with find
The find utility traverses the filesystem hierarchy in real time, evaluating files against user-defined predicates and executing specified actions. find [starting-path] [search-criteria] [actions]
Essential find Search Criteria Reference
Criteria Flag Syntax & Format Technical Description & Examples
-name <pattern> find /etc -name "*.conf" Matches file names case-sensitively using shell globbing ( * , ? , [] ).
-iname <pattern> find ~ -iname "report.pdf" Matches file names case-insensitively .
-type <t> -type [f|d|l|b|c|s|p] Filters by file type: f (regular file), d (directory), l (symlink), b (block device), c (character device), s (socket), p (named pipe).
-size [+/-]\<N>[c|k|M|G] -size +100M Matches files larger than ( + ), smaller than ( - ), or exactly equal to size. Units: c (bytes), k (KiB), M (MiB), G (GiB).
-mtime [+/-]<N> -mtime -7 Matches files modified within the last <N> 24-hour periods ( -N ), more than <N> days ago ( +N ), or exactly <N> days ago.
-atime / -ctime -atime +30 Matches based on last access time ( atime ) or inode status change time ( ctime ).
-user <user> -user alice Matches files owned by the specified username or UID.
-group <group> -group developers Matches files owned by the specified group name or GID.
-perm [mode] -perm -4000 Matches permissions: exact mode ( 755 ), all bits set ( -mode ), or any bit set ( /mode ).
-maxdepth <N> -maxdepth 2 Restricts directory traversal depth to at most <N> levels below starting path.
-empty -empty Matches empty regular files (0 bytes) or empty directories.
find Actions: -exec , -delete , and -print0 # 1. Execute command once per file found (-exec ... {} \;):
$ find /var/log -name "*.old" -exec rm -f {} \;
# 2. Execute command with batched arguments (-exec ... {} +):
# Much faster because it launches fewer child processes:
$ find /tmp -type f -name "*.tmp" -exec rm -f {} +
# 3. Direct deletion action (-delete):
$ find /var/tmp -type f -atime +30 -delete
# 4. Safe null-terminated output for xargs:
- $ find /srv/data -type f -print0 | xargs -0 chmod 644
- 4. Fast Indexed Searching: locate & updatedb
Unlike find , which scans physical storage disks in real time, locate queries a prebuilt, indexed database of the filesystem (typically stored at /var/lib/mlocate/mlocate.db or /var/lib/plocate/plocate.db ). This makes locate virtually instantaneous.
The updatedb Indexer
The database is updated automatically via a daily cron or systemd.timer job running the updatedb command. Administrators can manually refresh the index immediately: # Manually rebuild the locate database as root:
- $ sudo updatedb
- Configuration via /etc/updatedb.conf
The /etc/updatedb.conf file controls updatedb behavior:
PRUNEFS : Filesystem types to exclude from indexing (e.g., nfs , proc , sysfs , tmpfs , iso9660 ).
PRUNEPATHS : Directory paths to exclude from indexing (e.g., /tmp , /var/tmp , /media ).
PRUNENAMES : Directory names to skip (e.g., .git , .svn ).
Key locate Command Options
Flag Long Option Detailed Operational Description
-i --ignore-case Ignores case distinctions in pattern matching.
-b --basename Matches pattern against the filename (basename) only, ignoring leading path directories.
-c --count Suppresses path output and prints only the total number of matching files found.
-r --regexp Interprets the search pattern as a regular expression.
-e --existing Prints only entries that currently exist on physical disk at query time (filters out deleted files). # Find all files matching nginx.conf case-insensitively:
$ locate -i nginx.conf
# Count how many python script files are indexed:
- $ locate -c "*.py"
- 5. Command Resolution Utilities: which , whereis & type
Linux provides three specialized tools for determining how command names are resolved.
1. The which Utility
The which utility takes a command name and searches the directories listed in the current user's $PATH environment variable , returning the absolute path of the first matching executable file: $ which ls
- /usr/bin/ls
- $ which python3
- /usr/bin/python3
- 2. The whereis Utility
The whereis utility searches standard system binary, manual page, and source code directories (independent of $PATH ):
Flag Functional Target
-b Search only for binary executables .
-m Search only for manual pages ( man ) .
- s Search only for source code trees . $ whereis tar
- tar: /usr/bin/tar /usr/include/tar.h /usr/share/man/man1/tar.1.gz
- $ whereis -b tar
- tar: /usr/bin/tar
- $ whereis -m tar
- tar: /usr/share/man/man1/tar.1.gz
- 3. The type Shell Builtin (Exam Favorite)
The type command is a Bash built-in utility that describes how a given command name will be interpreted if typed into the shell: whether it is a shell builtin , an alias , a shell function , a keyword , or an external executable on disk . # Inspecting builtins, keywords, and aliases:
- $ type cd
- cd is a shell builtin
- $ type for
- for is a shell keyword
- $ type ll
- ll is aliased to `ls -l --color=auto`
# Finding all matching instances in search order (-a):
- $ type -a echo
- echo is a shell builtin
- echo is /usr/bin/echo
# Returning only the concise type identifier (-t):
- $ type -t cd
- builtin
- $ type -t ls
- alias
- $ type -t grep
- file
⚠️ LPIC-1 Trap — which vs. type on Shell Builtins: Running which cd or which kill often produces misleading results or errors because cd is a shell builtin that does not exist as an independent binary in $PATH . To accurately determine whether a command is a shell builtin or alias, always use the type command.