bash find command-line files

Finding Files with find

`find` searches for files in a directory tree. Unlike `ls`, it goes deep into subdirectories.

It's incredibly powerful—you can find files by name, size, date modified, permissions, and then do something with them.

bash
# Find by name
find . -name "*.js"

# Find by name (case-insensitive)
find . -iname "readme*"

# Find directories only
find . -type d -name "node_modules"

# Find files modified in last 24 hours
find . -mtime -1

# Find and delete (careful!)
find . -name "*.tmp" -delete

# Find and execute command on each
find . -name "*.md" -exec wc -l {} \;
Command Line Confidence

This tip is from

Command Line Confidence

100 more tips like this one.

Get the Book