Courseiva
XK0-006Chapter 3 of 16Objective 1.3

Navigating the Filesystem

Exam objective 1.3 asks you to manage files and directories using command-line utilities. Navigating the filesystem is the very first skill you need because every other task — editing a config file, running a script, installing software — depends on knowing where you are and how to get to the right place. If you cannot move around the filesystem, you cannot do anything else in Linux.

12 min read
Beginner
Updated Jul 23, 2026
Editorial oversight: Johnson Ajibi· Security Systems Architect · MSc IT Security · IEEE Senior Member

A simple way to picture Navigating the Filesystem

The Office Filing System Analogy

An office administrator for a mid-sized company. Their job is to organise every piece of paper so anyone can find it in seconds. The filing cabinet is the root of the whole system. Inside, there are drawers — these are like the top-level directories. Each drawer contains hanging folders (subdirectories), and inside those are manila folders (further subdirectories) that hold individual documents (files).

The administrator has a strict rule: every drawer is labelled by department (Finance, HR, Projects). Every hanging folder within a department is labelled by year or project name. Every manila folder holds documents of a specific type, like contracts or meeting notes. To find the signed contract for Project Aurora from April 2023, the administrator opens the Projects drawer, finds the "Aurora" hanging folder, then the "Contracts" manila folder, and pulls out the document. They never dump everything into one drawer because that would be chaos.

In the Linux filesystem, you are that administrator. The root directory (/) is the filing cabinet. Directories like /home, /etc, and /var are the drawers. Subdirectories organise files further. When you type a path like /home/student/documents/report.txt, you are navigating through the filing cabinet, drawer by drawer, to reach the exact document. The commands pwd, ls, and cd are your hands — they tell you which drawer you are at, what is inside it, and let you move to another drawer. Without this structure, finding anything on a Linux system would be like searching a giant pile of unsorted paper on a desk.

How It Actually Works

The Linux filesystem is a hierarchy of directories (folders) and files. Think of it like an inverted tree. The topmost point is called the root directory, represented by a single forward slash (/). Everything else — all directories and files — sits underneath the root. This organisation is mandatory. It is not optional chaos like a messy desktop.

The path is the address that tells the system where a file or directory lives. There are two types of path: absolute and relative. An absolute path starts from the root. For example, /home/sarah/projects/script.sh means you begin at root (/), then go into home, then sarah, then projects, and finally the script.sh file. A relative path starts from your current location. If you are already inside /home/sarah, the relative path to the same file is simply projects/script.sh.

To navigate, you use a handful of fundamental commands.

pwd stands for 'print working directory'. It shows you the absolute path of where you are standing right now in the filesystem. Before you move anywhere, you should always confirm your location.

ls lists the contents of a directory. Typing ls by itself shows the contents of your current directory. You can point it at any directory: ls /etc shows everything inside the etc directory. Common options include ls -l (long format, shows permissions, owner, size, date) and ls -a (shows all files, including hidden ones that start with a dot).

cd means 'change directory'. It moves you to a different directory. For instance, cd /var/log moves you into the log directory. You can also use shortcuts: cd .. moves you up one level (to the parent directory), cd ~ moves you to your home directory, and cd - moves you back to the previous directory you were in.

Why does Linux use this structure instead of a flat list of files like a Windows desktop? Because Linux was built for multi-user systems from the start. The hierarchy keeps order. System configuration files belong in /etc. User data belongs in /home. Log files belong in /var/log. If everything were in one giant folder, finding anything would be impossible and security would be a nightmare. Different users could see each other's files by accident. The hierarchical system enforces boundaries.

The Linux Filesystem Hierarchy Standard (FHS) defines exactly where things go. This is not a suggestion. It is a convention that every Linux distribution follows. Here are some critical directories you must know for the XK0-006 exam.

/ — the root directory. The absolute start of everything.

/home — contains home directories for regular users. For example, a user named 'jane' has a home directory at /home/jane.

/etc — holds system configuration files. Things like network settings, user passwords, and software settings live here.

/var — stores variable data that changes over time, such as logs (/var/log) and print spools.

/tmp — temporary files that are deleted on reboot. Any user can write here.

/usr — contains user-installed software and shared libraries. Think of it as the place for programs not essential to booting the system.

/bin and /sbin — contain essential command binaries. /bin holds commands for all users; /sbin holds system administration commands for the root user.

Your home directory is your personal space inside the filesystem. When you log in to a Linux system, you automatically land in your home directory (~). This is where you save your personal files, scripts, and projects. You have full write permission here. You should never need to write files directly into system directories like /etc or /usr. That is the root user's job.

The command tree is a brilliant visual tool. Install it with sudo apt install tree on Debian-based systems, or yum install tree on Red Hat-based systems. When you run tree /home/student, it draws a branch-like diagram of every directory and file underneath that path. It makes the abstract hierarchy concrete.

To summarise: pwd tells you where you are, ls shows what is there, and cd moves you to a different place. Use absolute paths when you want to be precise no matter where you are. Use relative paths when you want to type less. Practise by navigating to /var/log, listing its contents, then moving to /etc, then back to your home directory. Repeat until it feels like walking through a house you know well.

A simplified Linux filesystem hierarchy showing the root directory (/) and common subdirectories.

Walk-Through

1

Identify Your Starting Position

Open a terminal and type pwd. This prints your current working directory. For a beginner, this is likely /home/[yourusername]. Knowing where you are is step one because every relative path you type will depend on this location.

2

List the Contents of Your Current Directory

Type ls to see what files and directories exist in your current location. Then type ls -la to see hidden files (dotfiles) and detailed information like permissions and sizes. This tells you what is available to navigate into.

3

Move into a Subdirectory Using a Relative Path

Type cd Documents (assuming a directory called Documents exists). You moved using a relative path. Then type pwd again to confirm you are now in /home/[yourusername]/Documents. This step teaches you that relative paths start from where you are.

4

Move Up to the Parent Directory

Type cd .. to go back up one level. Type pwd to see you are back in /home/[yourusername]. The double dot (..) always refers to the parent directory. This is how you climb back up the tree.

5

Move to a Different Directory Using an Absolute Path

Type cd /var/log. This absolute path starts from the root (/) and takes you directly to the log directory regardless of where you were. Type pwd to confirm you are in /var/log. Then type ls to see log files. This shows how absolute paths give you independence from your current location.

6

Return to Your Home Directory Using a Shortcut

Type cd ~ to jump directly back to your home directory from anywhere. Alternatively, type cd with no arguments to achieve the same result. This step demonstrates the fastest way to get home.

7

Return to the Previous Directory

From your home directory, type cd /tmp to move to the temporary directory. Then type cd - to leap back to where you were (home). The dash (-) remembers your previous location. Practise this to navigate between two directories quickly without typing long paths.

What This Looks Like on the Job

Imagine you have just joined the IT support team at a medium-sized e-commerce company. Your first ticket comes in: 'The web server is returning a 500 error for the checkout page.' Your senior colleague says, 'Go check the Apache error log, it is usually in /var/log/apache2/error.log. Also look at the site configuration in /etc/apache2/sites-available/.' If you cannot navigate the filesystem, you cannot even begin to troubleshoot.

Step by step, here is what you do.

First, open a terminal and run pwd to confirm you are in your home directory. Then use cd /var/log/apache2 to move to the Apache log directory. If that directory does not exist (maybe the company uses Nginx instead), you might type ls /var/log to see what log directories exist. You spot nginx. So you run cd /var/log/nginx and then ls to see the log files. You find error.log. You read it with less error.log or tail -n 50 error.log (tail shows the last lines of the file). The log reveals a database connection failure.

Now you need to check the site configuration. You run cd /etc/nginx/sites-available. Then ls to see the config files. You see default and myshop.conf. You open myshop.conf with vim or nano. Inside, you find the database hostname. You then navigate to /var/www/myshop to see the application files. The entire process takes five minutes if you know your way around. Without filesystem navigation skills, you would be lost, asking 'Where are the logs again?' every time.

Another common scenario: a developer asks you to deploy a new version of a web application. You download a tarball (a compressed archive, like a zip file) to /tmp. You extract it with tar -xzf app.tar.gz. Then you need to move the contents to the correct location: /var/www/html. You use mv /tmp/app/* /var/www/html/. But first, you check what is currently in /var/www/html with ls so you do not accidentally overwrite something important. You also verify the permissions with ls -l to ensure the files are owned by the www-data user so the web server can serve them.

If you ever need to find a file and do not know its exact path, you use the find command. For example, find / -name "config.php" searches the entire filesystem for a file named config.php. This is a lifesaver when you inherit a messy server. The locate command is faster but relies on a database that updates nightly. You run updatedb first to refresh it, then locate config.php.

In real IT work, you never memorise every path. You learn the common ones (/etc, /var/log, /home) and use ls and find to discover the rest. Efficient navigation is the difference between a five-minute fix and a thirty-minute hunt.

How XK0-006 Actually Tests This

The XK0-006 exam tests your ability to navigate the filesystem and manage files using command-line utilities. This is not a theory exam — it is practical. Expect questions that give you a scenario and ask what command to run or what output a command produces. You must know the exact syntax and options.

Key concepts that appear repeatedly:

Absolute vs relative paths: The exam loves to trap you with this. They might show a path like ./scripts/backup.sh and ask whether it is absolute or relative. The dot (.) means 'current directory', so any path starting with . is relative. An absolute path always starts with a forward slash (/).

The difference between cd and ls: cd moves you, ls shows you. A common trick question: 'What command shows your current location?' The answer is pwd, not ls or cd.

Hidden files: Files starting with a dot (.) are hidden by ls but visible with ls -a. The exam might ask you to list all files including hidden ones in a directory.

Parent directory shortcuts: The double dot (..) refers to the parent directory. A single dot (.) refers to the current directory. The question might describe a nested directory situation and ask what cd .. does.

Wildcards: The asterisk (*) matches any number of characters. The question mark (?) matches exactly one character. For example, ls file*.txt lists files starting with 'file' and ending with '.txt'. Expect a question that asks you to list all files with a three-letter extension.

The tree command: Not always installed by default, but the exam may ask what it does: displays a directory structure in a tree-like format.

The /root directory vs the / directory: /root is the home directory for the root user (the system administrator). / is the top of the entire filesystem. Beginners mix these up constantly.

Traps to watch for:

'cd /home' vs 'cd home': The first uses an absolute path. The second uses a relative path and will fail if you are not in the correct parent directory.

'ls -l' shows details but does not sort by size by default. Do not confuse it with ls -S which sorts by size.

The exam might ask what command you use to return to the previous directory. The answer is cd - (dash), not cd .. (which goes up one level).

They could present a snippet of output from ls -l and ask which column is the file size. The fifth column is the size in bytes.

Memorise these exact items:

pwd: print working directory. Always returns an absolute path.

ls: list directory contents. Options: -l (long), -a (all), -h (human-readable sizes).

cd: change directory. Special arguments: .. (parent), ~ (home), - (previous).

find: search for files. Syntax: find [path] -name [filename].

Absolute path: starts with /. Relative path: does not start with /.

Practise by opening a terminal and deliberately using these commands. Type pwd, then cd /var/log, then ls -la, then cd /etc, then cd ~. Do this until it is automatic. The exam will not ask you to define 'directory hierarchy' in theory. It will ask you to apply it.

Key Takeaways

The root directory (/) is the top of the Linux filesystem tree, and every other directory and file branches from it.

An absolute path always starts with a forward slash (/) and specifies a location from the root, regardless of your current directory.

A relative path does not start with a slash and depends on your current working directory, making it shorter but context-dependent.

The pwd command prints your current working directory as an absolute path, giving you your exact location at any moment.

The ls command lists files and directories, with -l for detailed information and -a to include hidden files starting with a dot.

The cd command changes your working directory, and special arguments like .. (parent), ~ (home), and - (previous) enable fast navigation.

Hidden files (prefixed with a dot) are not shown by a plain ls command but are visible with ls -a or ls -A.

The find command searches for files by name across the filesystem, using the syntax find [starting-path] -name [filename].

The /root directory is the home for the root user, not the top of the filesystem — that is the root directory (/).

Using cd with no arguments always returns you to your home directory, regardless of where you are.

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

Absolute Path

Always starts with a forward slash (/)

Works from any directory because it is rooted from /

Example: /home/student/Documents/file.txt

Relative Path

Does not start with a forward slash

Depends on your current working directory

Example: Documents/file.txt (if you are in /home/student)

pwd Command

Prints the current working directory as an absolute path

Does not change your location, only reports it

Common options: none (it just outputs the path)

ls Command

Lists the contents of a directory

Does change what you can see but not where you are

Common options: -l, -a, -h

cd .. (Parent Directory)

Moves up exactly one level to the parent directory

Always relative: works based on where you are

Cannot jump to a sibling or child directory

cd - (Previous Directory)

Moves back to the last directory you were in

Does not relate to hierarchy, only to history

Can jump between two directories regardless of depth

cd ~ (Home Directory)

Moves directly to the current user's home directory

Works from anywhere in the filesystem

The tilde (~) is a shortcut for the home directory path

cd /root (Root User's Home)

Moves to the root user's home directory at /root

Only works if you have permission (usually requires root)

Not the same as the root directory (/), which is the top of the tree

Hidden Files (Dotfiles)

File or directory names that start with a dot (.)

Hidden from plain ls, shown with ls -a

Examples: .bashrc, .ssh, .profile

Regular Files

File or directory names that do not start with a dot

Visible with plain ls

Examples: report.txt, scripts/, index.html

Watch Out for These

Mistake

The root directory (/) and the root user's home directory (/root) are the same place.

Correct

The root directory (/) is the top of the entire filesystem. The /root directory is the home directory for the root user account, located inside the filesystem. They are completely separate.

The word 'root' is used for two different things, and beginners assume one refers to the other. The exam deliberately tests this confusion.

Mistake

Typing cd by itself does nothing useful.

Correct

Typing cd with no arguments takes you to your home directory (~). It is a quick way to return home from anywhere in the filesystem.

Many beginners only use cd with a path argument and never learn the no-argument shortcut, so they miss its utility.

Mistake

The dot (.) in a path like ./script.sh means the path is absolute because it is explicit.

Correct

The dot (.) means 'current directory', so ./script.sh is a relative path. It is only explicit relative to your current location, not to the root of the filesystem.

The dot looks formal and specific, which misleads beginners into thinking it is absolute. The exam loves this trick.

Mistake

ls -a and ls -l show the same information, just formatted differently.

Correct

ls -a shows all files including hidden ones (dotfiles). ls -l shows detailed information (permissions, owner, size, date) but does not necessarily show hidden files unless combined as ls -la.

The letters 'a' and 'l' are easy to confuse because they are alphabetic neighbours. Beginners often think 'a' stands for 'all details' instead of 'all files'.

Mistake

The cd command can only move forward into deeper directories, not backward.

Correct

cd can move backward using cd .. (parent directory), cd - (previous directory), or cd ~ (home directory from anywhere).

New users think navigation is only forward like a menu tree, so they do not realise they can jump backward without retracing their steps.

Mistake

Every directory on a Linux system is a subdirectory of /home.

Correct

Only user home directories are under /home. System directories like /etc, /var, /usr, /bin, and /sbin are direct children of the root directory (/).

On Windows, the equivalent of 'home' (C:\Users) contains the entire user environment, so beginners project that structure onto Linux.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

What is the difference between / and /root in Linux?

The forward slash (/) is the root of the entire filesystem, the top of the hierarchy. /root is the home directory for the root user account. They are not the same place.

How do I go back to the previous directory after using cd?

Type cd - (a space and then a dash). This returns you to the directory you were in before your last cd command.

What does cd .. do?

cd .. moves you up one directory level, to the parent of your current directory. If you are in /home/student, cd .. takes you to /home.

How do I see all files including hidden ones in a directory?

Use ls -a. The -a flag stands for 'all' and shows every file, including hidden files whose names start with a dot (.)

What command tells me where I am in the filesystem?

The pwd command (print working directory) shows your current absolute path, such as /home/student.

What is an absolute path?

An absolute path is a file or directory location written from the root directory (/), such as /var/log/syslog. It works no matter which directory you are currently in.

Terms Worth Knowing

Keep going

You've finished Navigating the Filesystem. Continue through the XK0-006 study guide to build a complete picture of the exam.

Done with this chapter?