Kolam Ayer MakersLinux Foundations

Command: find

Use

find ~ -maxdepth 2 -type f

What It Does

find walks directory trees and prints paths that match rules.

Examples

Find files under your source tree:

find ~/src -type f

Limit depth while learning:

find ~ -maxdepth 2 -type d

Find Markdown files:

find ~/src/pages -name '*.md'

Find recently changed files:

find ~/src -type f -mtime -1

Find empty directories:

find ~/playground -type d -empty

Ignore permission noise when deliberately searching system paths:

find /etc -name '*.conf' 2>/dev/null

Watch Out

Quote glob patterns such as '*.md' so the shell does not expand them before find receives them.

Start shallow. Searching / can be slow and noisy.

Docs Pointers