find Command Examples in Linux¶
Introduction¶
These examples show practical ways to use find on a Linux terminal. Each example is written so you can adapt it for administration or troubleshooting.
Example 1: Basic Usage¶
find /etc -name passwd
This is the simplest form of the command and is a good starting point before adding options.
Example 2: Common Admin Task¶
find /var/log -type f -name "*.log"
This example reflects a common task on RHEL, Rocky Linux, AlmaLinux, or similar systems.
Example 3: Useful Option¶
find /var -type f -size +100M
This option helps narrow the result, change behavior, or handle a more realistic target.
Example 4: Real-World Scenario¶
find /home -mtime +30 -type f
Use this pattern when the task moves beyond a single basic command.
Example 5: Verification¶
find /tmp -maxdepth 1 -type f
Example output:
/etc/passwd
Common Mistakes¶
- Forgetting to quote wildcard patterns such as
*.log, causing the shell to expand them too early. - Using
-deletebefore printing and reviewing the matches. - Searching from
/without limiting scope, which can be slow and noisy.
Quick Reference¶
find /etc -name passwd
find /var/log -type f -name "*.log"
find /var -type f -size +100M
find /home -mtime +30 -type f
find /tmp -maxdepth 1 -type f
Related Guides¶
Summary¶
Good find usage means choosing the right option, keeping the target clear, and verifying the result with output you can explain.