📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Linux Command Line Searching Files

Searching Files

5 min read
find searches for files: find /var -name '*.log' finds all log files. grep searches inside files: grep -r 'error' /var/log searches recursively. Combine: find . -name '*.php' | xargs grep 'password'.

Finding Files and Content

# Find files
find / -name "nginx.conf"
find . -name "*.log" -mtime -7  # logs from last 7 days
find . -size +100M               # files over 100MB

# Search inside files
grep "error" app.log
grep -r "TODO" src/       # recursive
grep -n "function" app.js # show line numbers
grep -i "error" log.txt   # case-insensitive