find Command Cheat Sheet
A searchable reference of common Linux and Unix find commands and what each one does.
| Command | What it does |
|---|---|
find . -name "*.txt" | Find files whose name matches the pattern, case-sensitive, under the current directory. |
find . -iname "*.txt" | Find files by name ignoring case, so PHOTO.TXT and photo.txt both match. |
find . -name "notes.md" | Find files with an exact name anywhere below the current directory. |
find . -path "*/build/*" | Match against the whole path rather than just the file name. |
find . -not -name "*.log" | Find everything except files whose name matches the pattern. |
find . -maxdepth 1 -name "*.txt" | Limit the search to the current directory only, without descending into subfolders. |
find . -mindepth 2 -name "*.txt" | Skip the top level and match only files at least two directories deep. |
find . -iname "*.jpg" -o -iname "*.png" | Match either of two name patterns using -o for a logical OR. |
find . -type f -name ".*" | Find hidden files, whose names begin with a dot. |
find . -type f | List only regular files, skipping directories and other special entries. |
find . -type d | List only directories. |
find . -type l | List only symbolic links. |
find . -empty | Find empty files and empty directories. |
find . -type f -empty | Find only empty regular files of zero bytes. |
find . -type d -empty | Find only empty directories. |
find . -type f -name "*.sh" | Combine a type test and a name pattern, here to find shell scripts. |
find . -mtime -7 | Find files modified in the last 7 days, counting whole 24-hour periods. |
find . -mtime +30 | Find files last modified more than 30 days ago. |
find . -mmin -60 | Find files modified in the last 60 minutes. |
find . -newer reference.txt | Find files modified more recently than the given reference file. |
find . -atime +90 | Find files last accessed more than 90 days ago. |
find . -ctime -1 | Find files whose metadata changed in the last day. |
find . -mtime 0 | Find files modified within the last 24 hours. |
find . -newermt "2026-01-01" | Find files modified after a specific date using -newermt. |
find . -mmin +30 -mmin -90 | Find files modified between 30 and 90 minutes ago by combining two tests. |
find . -size +100M | Find files larger than 100 megabytes. |
find . -size -1k | Find files smaller than 1 kilobyte. |
find . -size +1G | Find files larger than 1 gigabyte. |
find . -size 0 | Find files that are exactly zero bytes, like -empty for files. |
find . -type f -size +500M | Find large regular files, a common way to reclaim disk space. |
find . -size +10M -size -50M | Find files in a size range by combining two size tests. |
find . -perm 644 | Find files whose permission bits are exactly 644. |
find . -perm -u+x | Find files that are executable by their owner, ignoring the other bits. |
find . -user alice | Find files owned by the user alice. |
find . -group staff | Find files belonging to the group staff. |
find . -readable | Find files the current user can read. |
find . -writable | Find files the current user can write. |
find . -perm -644 | Find files that have at least the 644 bits set, and possibly more. |
find . -name "*.tmp" -exec rm {} \; | Run a command once for each match, replacing the braces with the file path. |
find . -name "*.log" -exec gzip {} + | Run the command once with many paths appended, which is much faster than one run per file. |
find . -name "*.tmp" -delete | Delete each matched file directly, with no external command. |
find . -type f -print | Print the path of each match, which is the default action. |
find . -type f -print0 | Print matches separated by null characters, safe for names with spaces or newlines. |
find . -type f -print0 | xargs -0 rm | Pipe null-delimited paths into xargs to run a command in batches. |
find . -name "*.conf" -ok rm {} \; | Like -exec but ask for confirmation before running each command. |
find . -name "*.py" -exec grep -n "TODO" {} + | Combine find with grep to search inside the matched files. |
find . -name "*.txt" | xargs wc -l | Pipe the list of found files into another command using xargs. |
find . -type d -name .git -prune -o -name "*.js" -print | Use -prune to skip whole directories while searching. |
No commands match your search.
Runs entirely in your browser. Nothing you type is sent anywhere; open DevTools and watch the Network tab to verify zero requests.
What this tool does
This is a searchable quick reference for the Linux and Unix find command,
the standard way to locate files by name, type, modification time, size, permissions,
and owner, and then to act on the results. Each row pairs an exact command with a
plain-English note on what it does. Type in the filter box to search across both
columns, or tap a category button to focus on one kind of test. The whole list is
built into the page, so it works offline and sends nothing anywhere.
How to use it
Start typing in the Filter box. Entering name shows the
name-matching tests, entering size surfaces the size filters, and entering
delete jumps to the removal commands. The category buttons
(By name, By type, By time, By size, Permissions and owner, Actions) narrow the table to
one family and combine with the text filter, so you can pick Actions and type
exec to see only the command-running rows. Clear the box to see the full
sheet again.
Common use cases
- Cleaning up build artifacts, such as
find . -name "*.tmp" -delete. - Reclaiming disk space by locating large files with
find . -size +500M. - Spotting recently changed files with
find . -mtime -1while debugging. - Batch-processing matches by piping them into
xargsor using-exec. - Auditing permissions and ownership with
-perm,-user, and-group.
Common pitfalls
- Unquoted patterns. Writing
find . -name *.txtlets the shell expand the pattern before find sees it, which can cause errors or wrong matches. Always quote it asfind . -name "*.txt". - Confusing the time signs. With
-mtime, a minus sign means within the last N days and a plus sign means older than N days, so-mtime -7and-mtime +7select opposite sets of files. - Running -delete too early. find applies tests left to right, so put
-deletelast; placing it before the name test can delete far more than you expect. Preview with-printfirst. - Slow one-per-file commands. Ending
-execwith a single semicolon runs the command once per match. Use the plus form instead for far fewer runs when the command accepts many paths at once.
Frequently asked questions
- How do I find files by name?
- Use the -name test with a shell-style pattern, for example find . -name "*.txt" to match every file ending in .txt under the current directory. Quote the pattern so the shell passes it to find instead of expanding it first. For a case-insensitive match use -iname, which treats README and readme the same. Add -maxdepth 1 if you only want the current directory and not its subfolders.
- How do I find files modified in the last week?
- Use find . -mtime -7, where -mtime counts 24-hour periods and the minus sign means less than, so -7 matches files changed within the last seven days. Use a plus sign like -mtime +30 for files older than 30 days. For finer control, -mmin -60 matches the last hour, and -newer reference.txt matches everything changed after a given file.
- What is the difference between -exec {} \; and -exec {} + ?
- Both run a command on the files you find. Ending the command with {} \; runs it once per file, so 500 matches means 500 separate runs, which is slow but works when each run must see exactly one path. Ending with {} + appends as many paths as fit onto a single command line, so the command runs far fewer times and finishes much faster. Prefer {} + unless the command can only take one argument at a time.
- How do I find and delete files?
- The safest first step is to preview: run your find command with -print so you can see exactly what matches. When you are sure, append -delete, as in find . -name "*.tmp" -delete, to remove each match. Because deletion is permanent, always run the plain search first and double-check the list. You can also pipe null-delimited results into xargs -0 rm for the same effect.
- How do I find files by size?
- Use the -size test with a unit suffix: -size +100M finds files larger than 100 megabytes, -size -1k finds files under 1 kilobyte, and -size +1G finds files over a gigabyte. The plus sign means greater than and the minus sign means less than, while a bare number means an exact match in the chosen unit. Combine two tests like -size +10M -size -50M to match a range.
- Does this cheat sheet send my searches anywhere?
- No. The whole command list is baked into the page and every search and category filter runs locally in your browser with JavaScript, so nothing you type leaves your device. Open your browser DevTools and watch the Network tab while you filter to confirm there are zero requests.
Cite this tool
For academic, journalistic, or technical references. Pick a format:
Citations use 2026 as the publication year. Access date is left as a fillable placeholder where the citation style expects one.