Chapter 4

Linux File System

The Linux file system looks different from Windows. In this chapter you'll learn the main folders, how paths work, and how to think in terms of the Linux directory tree.

Introduction

Linux file system

The Linux file system is organized as a single tree. Everything starts from root.

Single tree structure: In Linux there are no drive letters like C: or D:. Everything starts from a single root directory: /.

Important Linux directories

Here are some of the most common directories you will see on a Linux system:

DirectoryDescription
/Root of the entire file system tree.
/homeHome directories for normal users (e.g. /home/alex).
/rootHome directory for the root (administrator) user.
/etcSystem-wide configuration files.
/binEssential user commands (ls, cp, mv, etc.).
/usr/binMost installed user applications and commands.
/varVariable data like logs, caches, and queues.
/tmpTemporary files (often cleared on reboot).
/devDevice files (disks, USB devices, etc.).
/mntTemporary mount points for additional file systems.

Absolute vs relative paths

Paths describe where a file or folder lives in the file system:

ConceptExample / Explanation
Absolute path /home/alex/documents/report.txt – starts from / and includes the full path.
Relative path documents/report.txt – relative to your current directory.
Current directory (.) ./script.sh – run script.sh in the current directory.
Parent directory (..) ../pictures – go to the pictures folder one level up.

Your home directory

Linux file system

Your home directory (for example /home/yourname) is where you store personal files, code, downloads, and config. You usually have full control here.

Useful commands related to the file system

You will use these commands often when exploring the Linux file system:

CommandWhat it does
ls /List the top-level directories under root.
ls /homeList user home directories.
cd /etcGo to the system configuration directory.
treeShow directory tree (may need to install the tree package).
df -hShow disk space usage for file systems.
du -sh *Show size of each item in the current folder.

Practice questions

Question 1

From your terminal, run ls / and write down at least 5 directory names you see. What do you think each one is used for?

Hint: Look for /home, /etc, /var, /bin, /usr and guess based on their names.

Question 2

Explain the difference between an absolute path and a relative path in your own words, with one example of each.

Hint: Think about whether the path starts from / or from your current location.

Quiz

Test your understanding. Click an answer to see if it's correct.

1. Which directory contains user home folders?

  • /etc
  • /var
  • /home
  • /bin

Your personal files live under /home/<username>.

2. Which of the following is an absolute path on a Linux system?

  • documents/report.txt
  • ../pictures/photo.png
  • /home/user/downloads/file.zip
  • ./script.sh

Absolute paths always start with / and describe the full location.

3. What is the purpose of the /etc directory in Linux?

  • Storing user home directories
  • Storing temporary files
  • Storing system configuration files
  • Storing personal photos and videos

Most configuration files for services and system settings live in /etc.

4. Which command would you use to see how much disk space is left on your file systems?

  • ls
  • df -h
  • pwd
  • cat /etc/fstab

df -h shows disk usage in a human-readable format (GB, MB).