$
Learn Linux handbook
en
XP:0
Quest 82Scout
+220 XP

Finding Files by Name (find)

Launch Interactive Terminal for This Quest→No installation required • Runs fully in browser

Concept & Overview

Imagine misplacing an important text file somewhere in your user folder and having to search through dozens of nested directories one-by-one. In Linux, we bypass manual digging by using the find utility as a lightning-fast system-wide search engine.

- The find command searches through directory trees based on name, size, type, or date.
- The syntax is find -name "". E.g., find . -name "*.txt" searches the current directory and all subfolders for files ending in .txt.

Why this matters: If you run find . "*.log" without -name, you will get the error: find: paths must precede expression: '*.log'. The -name flag is required to specify that the subsequent pattern should be matched against the filenames.

Let's track down some files. Search the current directory and its subfolders for any files with a .log extension by running find . -name "*.log".

Command Syntax Reference

Command / SyntaxDescription
find . -name "*.log"Find all files ending in .log in current folder and subfolders

Verification Objectives

These conditions will be automatically verified when you run commands inside the interactive terminal simulator:

  • ○
    Run the "find" command with -name option

Ready to complete Quest 82?

Test your skills live in the browser terminal with an emulated Linux filesystem, real-time command evaluation, and instant step-by-step hints.