The Filesystem
In Linux, everything is a file. Devices, sockets, processes — all represented as files somewhere in the tree. Understanding the layout is step one.
There is exactly one tree. Windows gives you C: and D:; Linux gives you /
and hangs everything off it, including your second disk and your USB stick.
Learn this shape once and you can find your way around any Linux box you are
ever dropped onto.
The Tree
- /
- bin
- boot
- dev
- etc
- home
- you
- .ssh
- .bashrc
- you
- lib
- opt
- proc
- root
- sbin
- srv
- tmp
- usr
- bin
- local
- share
- var
- log
- www
The colours are the security read, not part of the standard:
| Colour | Means | Why you care |
|---|---|---|
| 🔴 Red | Secrets and control | Configuration, keys, credentials. Where an attacker looks first, and what a defender watches. |
| 🟠 Orange | Writable or volatile | Anyone can write to /tmp. Web roots and logs get attacker-influenced content. |
| 🔵 Cyan | Not real files | /proc and /dev are the kernel pretending to be a filesystem. Nothing here is on your disk. |
| 🟢 Green | Yours | Your files, your dotfiles, your keys. |
| ⚪ Grey | Programs | Binaries and libraries. Mostly read-only, and a change here is worth noticing. |
Two things surprise people coming from Windows:
/proc is fake. It is a view into the running kernel rendered as text
files. cat /proc/self/status tells you about the process that ran cat.
Nothing under /proc exists on disk, which is why it survives no reboot and
why it is the fastest way to inspect a live system.
/root is not /. /root is the superuser’s home directory. / is the
top of the tree. They are different places, and mixing them up in a command is
how people delete things they did not mean to.
Key Directories
| Path | What lives there |
|---|---|
/ |
Root of the entire filesystem |
/home/username |
Your personal files |
/etc |
System configuration files |
/var |
Logs, databases, runtime data |
/tmp |
Temporary files — cleared on reboot |
/usr/bin |
User-installed executables |
/bin, /sbin |
Core system executables |
/proc |
Virtual filesystem exposing kernel/process info |
/dev |
Device files |
When you are looking for a config file, start in /etc. When you are looking for a binary, check /usr/bin. When you are debugging a process, look in /proc.
Navigation
Finding Files
find searches in real time. locate uses a cached index — run updatedb first if results are stale.
Reading Files
Identify Before You Trust
The extension is a suggestion. The bytes are the truth.
A CTF file named photo.jpg that file calls a ZIP archive is the challenge telling you what to do next.
Hidden files start with a dot. ls skips them. ls -la does not, and neither should you. Reference: file(1).
Disk, Links, and Environment
Two directories are writable by everyone on almost every Linux system: /tmp and /dev/shm. When you cannot write anywhere else, you can write there. /dev/shm lives in RAM and is gone after a reboot.
In CTF Environments
On a Linux CTF box (HackTheBox, TryHackMe, etc.), filesystem enumeration is your first move after getting a shell.
Initial orientation after landing a shell:
Hunt for credentials and interesting files:
Checking for flags specifically:
Using AI
Where it helps on filesystem tasks:
- Understanding find syntax: The flags are cryptic. Describe what you want to find and AI will produce the right
findcommand. Then learn what each flag does. - Reading unfamiliar config files: Paste a
sshd_config, nginx config, or cron file. Ask what is misconfigured or interesting from a security perspective. - Explaining output: Paste the output of
ls -laon an unusual directory and ask what the permissions mean. - Building enumeration checklists: “What files and directories should I check after getting a low-privilege shell on a Linux box?” AI knows the standard checklist — use it as a prompt, then verify manually.
How the Club Uses This
TODO: Add specific lab exercises or CTF challenges where filesystem navigation was key.
References
- Linux Filesystem Hierarchy Standard
- explainshell.com — paste any command and get it explained
- linuxcommand.org
-
The Filesystem
- Permissions & Users
- Processes & Services