Linux Filesystem
Learn the Linux directory hierarchy and the purpose of the folders you'll touch every day.
One of the biggest differences between Windows and Linux is how files are organized. Windows uses drive letters like C:\ and D:\. Linux has no drive letters β everything grows from a single root directory called /. Think of it as the top of a giant tree.
π― Learning Objectives
By the end of this lesson you will:
- Understand the Linux filesystem hierarchy
- Know the purpose of the most important directories
- Navigate between directories
- Find where configuration files and logs live
The Linux Directory Tree
Every Linux system β Ubuntu, Debian, CentOS, Amazon Linux β follows this structure:
/
βββ bin # essential commands (ls, cp, mv)
βββ boot # boot loader files
βββ dev # device files
βββ etc # configuration files
βββ home # user home directories
βββ lib # shared libraries
βββ opt # optional / third-party software
βββ proc # kernel & process info (virtual)
βββ root # the root user's home
βββ tmp # temporary files
βββ usr # installed software
βββ var # logs and changing dataThe Directories That Matter Most
| Directory | Purpose |
|---|---|
/ |
The root β everything starts here |
/home |
Personal user folders (/home/student) |
/etc |
Configuration files (/etc/hosts, /etc/passwd) |
/var |
Changing data β logs, cache, databases (/var/log) |
/tmp |
Temporary files (may be auto-cleaned) |
/usr |
Installed software and applications |
/bin |
Essential commands like ls, cp, cat |
/root |
The root userβs home β not the same as / |
β / is not /root
/ is the top of the entire filesystem. /root is just the home directory of the root (admin) user. They look similar but are completely different places.
Moving Around the Tree
cd # go to your home directory
cd / # go to the root directory
cd /var/log # jump to the log directory
ls /etc # list configuration files
ls ~ # list your home folderReal DevOps Example
When a web server stops working, a DevOps engineer usually starts by reading the logs:
Many production problems are diagnosed simply by reading /var/log.
π§ͺ Hands-on Lab
Explore the Filesystem
- Display your current directory
- Go to the root directory and list its contents
- Return to your home directory
- Display the contents of
/etc - Display the contents of
/var/log
π‘ DevOps Tip
You donβt need to memorize every directory β just remember the purpose of the important ones: /home, /etc, /var, /tmp, /usr, /bin.
π§ Knowledge Check
Which directory stores configuration files?
Where are system logs usually stored?
πΌ Interview Preparation
What is the Filesystem Hierarchy Standard (FHS) and why does it matter?
Summary
You now understand the Linux filesystem hierarchy β essential for troubleshooting servers, configuring applications, and working with cloud infrastructure.