$
Learn Linux handbook
en
XP:0

Chapter 09 of 17

Find evidence efficiently

Choose between a live filesystem search, a cached index, and searching inside files.

The mental model.

find traverses a live directory tree and evaluates predicates such as name, type, age, and size. grep searches file contents. locate searches a database and may return stale paths or miss new files until its index is updated.

Quote a find pattern such as "*.log" so that the current shell does not expand it prematurely. Limit the starting directory to the smallest useful scope, especially on busy or remote filesystems.

which looks for executables along PATH, while the shell’s type can also identify aliases and builtins. A command may resolve differently after PATH or alias changes; inspect resolution when a familiar command behaves unexpectedly.

On a real machine, first print search results before adding deletion or execution. Permission errors indicate incomplete visibility, not proof that the target does not exist.

Read it. Predict it. Try it.

Before running these commands, predict what each line will change or print. Launch a quest below to open the simulated terminal.

find /home/learner -type f
find /var/log -name "*.log"
which bash
type cd

Search a bounded tree, filter names, and distinguish an executable from a shell builtin.

Check your understanding

Explain the why.

Which search can miss a new file because its index is stale?

Put it into practice.

Complete the exercises, then try the Boss Challenge without hints. Each quest checks its own objectives. You can revisit this chapter at any time.

Prefer to read first?

Make the learning stick.

Close the explanation and describe the main idea in your own words. Change a filename or input and predict the outcome. Tomorrow, repeat a quest without hints. Then apply it in a disposable real Linux environment.

Open the real-system labs →