Latticework

Command Palette

Search for a command to run...

Linux

Filesystem

14 min

Explanation

Everything on a Linux system — files, directories, and (conceptually) devices — lives under one tree rooted at /, no matter how many physical disks are actually involved; other drives get mounted at some directory inside that same tree rather than getting their own separate root. Your home directory (/home/user in this simulator) is where you start and where you typically keep your own files. find PATH -name PATTERN searches an entire directory tree recursively for files matching a name pattern — unlike ls, which only looks one level deep.

mkdir -p var/log/app
touch var/log/app/access.log
touch var/log/app/error.log
find var -name "*.log"
# /home/user/var/log/app/access.log
# /home/user/var/log/app/error.log
Try it

find with no -name lists every file and directory in the tree; adding -name filters it down to just the paths whose final component matches the given pattern.

Loading editor…
Exercise

Create the directories and files needed so that `var/log/app/access.log` and `var/log/app/error.log` both exist, then use `find` to list every file under `var` whose name ends in `.log`.

Quiz

Linux has a single unified filesystem tree rooted at `/`. What does that mean in practice, compared to something like `C:\` and `D:\` on Windows?

Checkpoint

You understand Linux's single unified filesystem tree, and can search it recursively with find.