Handling large numbers of files is routine for Linux users, and that’s where the find command shines. It’s a dynamic tool that helps you search for files and directories based on name, type, modification date, size, permissions, and even content. Whether conducting audits, cleaning up old files, or troubleshooting, find ensures you locate exactly what you need, quickly and efficiently.
find [location] [options] [expression]/home/documents)| Option | Purpose | Example |
|---|---|---|
| -name | Case-sensitive name search | find ~ -name “notes.txt” |
| -iname | Case-insensitive name search | find ~ -iname “notes.*” |
| -type | Restrict search to files (-f) or directories (-d) | find /var/log -type f |
| -size | Find files by size (e.g., +10M for over 10MB) | find /tmp -size +100M |
| -mtime | Search by last modified time (in days; -7 for past week) | find . -mtime -7 |
| -perm | Filter by permission bits | find /etc -perm 755 |
| -exec | Run another command on each match | find . -name “*.bak” -exec rm {} ; |
| -empty | Locate empty files or directories | find ~/backups -empty |
| -maxdepth | Limit how deep find searches | find . -maxdepth 2 -type d |
To find a file named budget.xlsx anywhere under /projects:
find /projects -name "budget.xlsx"Need any .pdf file in your Downloads?
find ~/Downloads -name "*.pdf"Not sure about the casing? Use -iname:
find /srv -iname "README*"Looking for log files larger than 50MB?
find /var/log -type f -size +50MTo find documents changed in the last 24 hours:
find ~/work -type f -mtime -1Remove .cache files under /tmp with a single command:
sudo find /tmp -type f -name "*.cache" -exec rm {} \;Generate a tree of folders within your Git repository:
find ~/git/myapp -type dDeclutter unused empty folders from your Notes project:
find ~/notes -type d -emptyShow all files with 600 permissions for security review:
find /etc -type f -perm 600Find all .conf files containing the word “server”:
find /etc -name "*.conf" -exec grep -l "server" {} \;The find command processes each directory and subdirectory from the specified location in real time. Unlike locate, which relies on a database, find actively checks all files right at search time, ensuring results always reflect the current state of your filesystem. You can combine expressions for advanced precision, and even execute actions instantly on found matches, such as copying, deleting, or changing permissions.
With options for filtering by type, name, permissions, modification date, and actions, find is a powerhouse for system maintenance, bulk operations, security checks, and development workflows. Its flexibility saves time and reduces manual effort, making it an indispensable skill for every Linux user.
Read More: The shell
Introduction Artificial Intelligence is changing how cybersecurity professionals work, especially in penetration testing. Tools that…
The Windows Registry Editor lets you easily view and control critical Windows system and application…
In the rapidly expanding Internet of Things (IoT) ecosystem, billions of devices are constantly exchanging…
Have you ever come across a picture on the internet and wondered where it came…
Overview WhatsMyName is a free, community-driven OSINT tool designed to identify where a username exists…
Managing disk usage is a crucial task for Linux users and administrators alike. Understanding which…