The Linux filesystem is the organisational structure that stores every file, program, and setting on your computer. Understanding this hierarchy and how to navigate it is the most fundamental skill you need to pass the LFCS exam because every command you run and every file you edit depends on knowing where things live and how to get there.
Jump to a section
A simple way to picture Linux Filesystem Hierarchy and Navigation
A big department store is organised into clearly labelled departments, each on its own floor or section. The ground floor is the lobby where you find the directory and customer service. The men's clothing department is on the second floor, women's on the third, and home goods on the fourth. Inside each department, items are further sorted on shelves and racks. The fitting rooms are in a specific corner. The stockroom is in the basement, and the employee break room is behind a door marked 'Staff Only'. Every area has a fixed location and a purpose.
When you first enter, you are in the lobby, just as when you first log into a Linux system you are in your home directory. To find socks, you go up to the second floor, just as you use 'cd /home' to move to the home directory. To see what's on a shelf, you look, just like using 'ls' to list files. To go back to the lobby to find the exit, you go down to the ground floor, just as 'cd /' takes you to the root of the filesystem. The directory map at the entrance tells you where everything is, similar to the root filesystem structure. This precise organisation lets 10,000 shoppers move efficiently without chaos, just as the Linux filesystem hierarchy keeps hundreds of thousands of files and programs accessible without confusion.
The Linux filesystem is a single, unified tree of directories that starts at the root, represented by a forward slash (/). Everything on a Linux system, from system configuration files to user documents to installed programs, lives somewhere in this tree. Unlike Windows, which uses separate drive letters like C: and D:, Linux has one root directory, and all storage devices are attached to directories within this tree. This is called 'mounting'.
Every directory and file has a path. An absolute path starts from the root, for example '/home/john/documents/report.txt'. A relative path starts from your current location, for example 'documents/report.txt' if you are already in '/home/john'. You use the 'pwd' command to print your current working directory, showing you exactly where you are in the tree.
To move between directories, you use the 'cd' command (change directory). To see what is inside a directory, you use 'ls' (list). These two commands are your primary tools for navigation. For example, to see what's in the root directory, you type 'ls /'. To go to the 'etc' directory and list its contents, you type 'cd /etc' then 'ls'.
The Linux filesystem follows the Filesystem Hierarchy Standard (FHS), which defines the purpose of each major directory. Here are the most important ones you need to know for the LFCS exam:
/ (root): the top of the filesystem tree. Every other directory hangs off this one.
/bin: essential user command binaries (programs) like 'ls', 'cp', 'mv'. On many modern systems, /bin is a symbolic link to /usr/bin.
/boot: files needed to boot the system, including the Linux kernel and bootloader configuration.
/dev: device files that represent hardware components like hard drives (sda), terminals, and printers.
/etc: system-wide configuration files. For example, /etc/passwd stores user account information.
/home: personal directories for regular users. Each user gets a subdirectory, like /home/alice.
/lib: shared library files needed by programs in /bin and /sbin to run.
/media and /mnt: mount points for removable media (like USB drives) and temporarily mounted filesystems.
/opt: optional third-party software packages.
/proc: a virtual filesystem that provides information about running processes and system resources.
/root: the home directory for the root user (system administrator).
/sbin: essential system binaries used for system administration, like 'fdisk' and 'mkfs'.
/tmp: temporary files that are deleted on reboot.
/usr: the largest directory, containing user utilities, applications, and libraries. Most programs live under /usr/bin and /usr/lib.
/var: variable data that changes frequently, such as log files (/var/log), print queues, and databases.
When you log in, you are placed in your home directory. Your prompt typically looks like 'user@hostname:~$'. The tilde (~) is a shortcut for your home directory. So 'cd ~' takes you home, and 'cd ~/documents' takes you to a documents folder inside your home directory.
Special directory entries exist in every directory: '.' represents the current directory, and '..' represents the parent directory. So 'cd ..' moves you one level up. 'cd ../../' moves two levels up.
You can create directories with 'mkdir', remove empty directories with 'rmdir', and copy, move, and delete files with 'cp', 'mv', and 'rm'. Understanding paths and how to navigate efficiently is essential for managing files, editing configuration, and running scripts.
Open the Terminal
You need a terminal emulator to enter commands. On most Linux systems, you can find it in the applications menu or use Ctrl+Alt+T. This opens a shell (usually Bash) where you can type commands.
Find Your Current Location with pwd
Type 'pwd' and press Enter. The shell prints your current working directory. Typically, when you first open a terminal, you are in your home directory, like '/home/jane'. This tells you where you are in the filesystem tree.
List Contents with ls
Type 'ls' and press Enter. The shell lists files and directories in your current location. You can also type 'ls /etc' to list the contents of the /etc directory without moving there. This helps you see what is available before navigating.
Change Directory with cd
To move to a different directory, use 'cd' followed by the path. For example, 'cd /etc' moves you to the /etc directory. To go back to your home directory, type 'cd' with no arguments or 'cd ~'. To go up one level, use 'cd ..'.
Create a New Directory with mkdir
To organise your files, you can create a new directory with 'mkdir directoryname'. For example, 'mkdir projects' creates a folder named 'projects' in your current directory. You can also create nested directories with 'mkdir -p parent/child'.
Remove a File or Directory with rm and rmdir
To remove an empty directory, use 'rmdir directoryname'. To remove a file, use 'rm filename'. To remove a directory and all its contents, use 'rm -r directoryname'. Be careful: deletion is permanent and does not go to a trash bin.
Imagine you are a junior systems administrator at a small e-commerce company. A developer has deployed a new version of the company's website, but the site is not loading. The developer says, 'Check the Apache logs. They're somewhere in /var/log.' You need to find the error quickly so the site comes back up.
You SSH (secure shell) into the production server. Your prompt shows you are in your home directory, '/home/jane'. You type 'cd /var/log' to move to the logs directory. You then type 'ls' and see many files: 'syslog', 'auth.log', 'apache2/', and others. You need to look at Apache's access log, so you type 'cd apache2' and then 'ls'. You see 'access.log' and 'error.log'. You use 'cat error.log' to view the file, but it is huge. You instead use 'head -n 50 error.log' to see the last 50 lines. You spot an error: 'Permission denied: /var/www/html/index.html'.
Now you know the problem: the Apache web server cannot read the website's main page. You need to check the permissions on that file. You navigate to '/var/www/html' using 'cd /var/www/html'. You type 'ls -l' and see that the 'index.html' file has permissions '-rw-------' which means only the owner can read it. Apache runs as the 'www-data' user, not the file owner. You use 'chmod 644 index.html' to give read access to everyone, and then 'systemctl restart apache2' to reload the web server. The site comes back up.
This real-world scenario shows how fundamental filesystem navigation is to troubleshooting. Every step required knowing where logs live (/var/log), where web files live (/var/www), how to move around with 'cd', list files with 'ls', and view file contents with 'cat' or 'head'. Without this knowledge, you would be lost.
As an LFCS-certified administrator, you will regularly:
Navigate to /etc to edit configuration files like 'sshd_config' for SSH settings.
Check /var/log/syslog for system-wide error messages.
Look in /proc/cpuinfo to see CPU information.
Use 'find' and 'locate' to search for misnamed files.
Create directories in /home for new users.
Mount external drives to /mnt or /media.
Check disk space in / using 'df -h'.
The LFCS exam tests objective 1.1, 'Understand and use essential tools for navigating the Linux filesystem', directly and thoroughly. Expect at least 5-10 questions on this topic across the multiple-choice and performance-based sections.
The exam will test your ability to:
Identify the purpose of standard directories: you will be asked 'Which directory contains system-wide configuration files?' The answer is '/etc'. They might ask which directory holds user home directories (/home), which holds log files (/var/log), or which holds essential binaries (/bin or /usr/bin).
Use absolute vs. relative paths: a question might show a path like '../../documents/report.txt' and ask what it refers to. You must correctly interpret that it goes up two directories and then into 'documents'.
Understand the special entries '.' and '..': you might be asked 'What does 'cd ..' do?' The answer is it moves to the parent directory.
Recognise the tilde (~) shortcut: 'Which directory does 'cd ~' take you to?' Your home directory.
Use 'pwd', 'cd', and 'ls' correctly: a performance-based task might ask you to navigate to '/var/log' and list its contents using only these commands.
Understand the root directory: 'What does '/' represent?' The root of the filesystem tree.
Know that the FHS standard is used: you may be asked to identify non-standard directory locations.
Common traps on the exam:
Confusing /bin with /sbin: /bin has user commands, /sbin has system administration commands.
Thinking /root is the same as /: /root is the root user's home directory, not the root of the filesystem. The root of the filesystem is just '/'.
Mixing up /media and /mnt: /media is typically used by the system to auto-mount removable devices; /mnt is for temporary manual mounts.
Assuming all programs are in /bin: many are in /usr/bin, and on modern systems /bin is often a symlink to /usr/bin.
Forgetting that 'cd' with no arguments takes you home: typing just 'cd' is the same as 'cd ~'.
Key definitions to memorise:
Root directory: the top of the filesystem tree, represented by '/'.
Absolute path: a path starting from root, e.g., /home/user/file.txt.
Relative path: a path relative to your current location, e.g., ../file.txt.
Home directory: a user's personal directory, typically /home/username.
Current working directory: the directory you are currently in, shown by 'pwd'.
Parent directory: the directory one level up, represented by '..'.
FHS (Filesystem Hierarchy Standard): the standard that defines the directory structure.
The Linux filesystem is a single tree starting at the root directory (/), with no separate drive letters.
Every file and directory has an absolute path starting from /, and you can also use relative paths from your current location.
The 'pwd' command shows your current working directory at any time.
Use 'cd' to change directories, 'ls' to list contents, and '.' and '..' for current and parent directories.
The tilde (~) is a shortcut for your home directory, and 'cd ~' takes you there.
The Filesystem Hierarchy Standard (FHS) defines the purpose of each major directory like /etc for configs and /var/log for logs.
Know the difference between / (root) and /root (root user's home directory) — the exam tests this.
Absolute paths always begin with /, relative paths never do.
'mkdir' creates directories, 'rmdir' removes empty ones, and 'rm' removes files or directories with '-r' flag.
The 'ls -l' command shows detailed information including permissions, owners, and modification dates.
These come up on the exam all the time. Here's how to tell them apart.
/ (root)
The topmost directory in the filesystem tree
Contains all other directories and files
Represented by a single forward slash
/root (root user home)
The home directory for the root user
Located at /root, under the root directory
Contains the root user's personal files and settings
Absolute path
Starts with a forward slash (/)
Specifies the full location from root
Always refers to the same location, regardless of current directory
Relative path
Does not start with a forward slash
Specifies location relative to current directory
Changes meaning depending on your current location
/bin
Contains essential user command binaries
Used by all users for common tasks
Examples: ls, cp, mv, cat
/sbin
Contains system administration binaries
Used by root for system maintenance
Examples: fdisk, mkfs, shutdown
/etc
Contains system-wide configuration files
Files are relatively static and rarely change
Examples: passwd, fstab, sshd_config
/var
Contains variable data that changes frequently
Includes logs, queues, and temporary files
Examples: log files in /var/log, spool files in /var/spool
rmdir
Removes only empty directories
Fails with an error if directory has contents
Cannot remove files
rm -r
Removes directories and their entire contents recursively
Use with caution as it is irreversible
Also removes regular files when used without -r
Mistake
The root directory / and the /root directory are the same thing.
Correct
/ is the top of the entire filesystem tree. /root is the home directory for the root user, located under /.
Both contain 'root' in their name, so beginners assume they are identical. The exam specifically tests this distinction.
Mistake
The tilde (~) always refers to the current user's home directory.
Correct
By default, yes, but in scripts or when using sudo, ~ may expand to the home directory of the user running the command, not necessarily the current logged-in user. Also, ~username refers to that specific user's home directory.
Beginners see ~ used in examples and think it is a universal shortcut for 'my home folder', not understanding it can vary depending on context.
Mistake
You can delete a file by navigating to its directory and typing 'rmdir'.
Correct
'rmdir' only removes empty directories. To delete a file, you use 'rm'. To delete a non-empty directory, you use 'rm -r'.
Beginners confuse 'rmdir' with 'rm' and think both are just for removing things, not understanding the specific use case of each command.
Mistake
All Linux distributions have exactly the same filesystem layout.
Correct
While most follow the FHS, there are differences. For example, on Red Hat based systems, user binaries are often in /usr/bin, while on Debian based systems, /bin and /usr/bin may be separate directories or symlinks.
Beginners think 'Linux is Linux' and overlook distribution-specific variations, which the exam may exploit in questions about specific file locations.
Mistake
The 'ls' command only shows files and directories in the current directory.
Correct
'ls' can list any directory you specify as an argument. For example, 'ls /etc' lists the contents of /etc, not the current directory. It also has many options to show hidden files, permissions, and more.
Beginners use 'ls' without arguments and assume that is its only mode, not realising it can accept paths and options for advanced use.
Mistake
The 'cd' command changes the directory permanently for all terminal sessions.
Correct
'cd' only changes the current directory for the current shell session. Each terminal window or tab has its own current working directory. Changing directory in one does not affect another.
Beginners think in terms of a single file explorer where one change affects everything, but terminal sessions are independent.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
/ is the root of the entire filesystem tree, the topmost directory. /root is the home directory for the root user, which is a regular directory located at /root, under the root.
Use 'cd -' (cd with a dash). This takes you to the previous directory you were in, not the parent directory. It is a quick toggle between two directories.
'ls -la' lists all files and directories in the current location, including hidden files (those starting with a dot), with detailed information like permissions, owner, size, and modification time.
Files and directories that start with a dot (.) are hidden from normal 'ls' output. Use 'ls -a' or 'ls -A' to see all files including hidden ones. These are often configuration files in your home directory.
An absolute path starts with a slash (/) and specifies the full location from the root, like /home/jane/report.txt. A relative path does not start with a slash and is based on your current directory, like report.txt if you are in /home/jane.
Use the 'df' command, often with the '-h' flag for human-readable sizes. For example, 'df -h' shows disk usage for all mounted filesystems. To check a specific directory, use 'du -sh /directoryname'.
Yes, pressing Tab while typing a path auto-completes file and directory names. If multiple options exist, press Tab twice to see a list. This saves time and reduces typing errors.
You've finished Linux Filesystem Hierarchy and Navigation. Continue through the LFCS study guide to build a complete picture of the exam.
Done with this chapter?