What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Use find DIRECTORY -name 'filename' to search a directory tree. For example, find . -name 'report.txt' searches the current directory and its subdirectories and prints matching paths. Replace . with a directory path to search somewhere else.
Basic command to find a file
The general form is find STARTING_PATH TESTS. The starting path determines where the search begins; the tests determine which entries to report.
find . -name 'report.txt'
This searches recursively from the current directory. To search a specific directory, use its path:
find /home/alex/documents -name 'report.txt'
If you omit the starting path, GNU find uses the current directory. GNU documents this behavior in its find invocation reference.
Find files by extension or partial name
Find all files with an extension
To list regular files ending in .txt anywhere below the current directory, run:
find . -type f -name '*.txt'
-type f limits results to regular files rather than directories or other filesystem entries. Keep the pattern in quotes: otherwise, the shell may expand *.txt against files in the current directory before passing it to find.
Find a name containing a word
Use wildcards to match part of a basename:
find . -name '*report*'
-name tests only the entry’s basename, not its full path. A pattern containing a slash will not work as a path match; use -path when the pattern should match a path instead. See GNU’s basename pattern reference.
Rank #2
- The Unix Programming Environment (Prentice-Hall Software Series)
- Product Type: ABIS_BOOK
- Pearson
Make the search case-insensitive or limit its depth
Ignore capitalization
GNU find provides -iname for a case-insensitive basename match:
Free tools Windows power users keep installed
One-click scans. No signup required.
find . -iname 'report.txt'
This GNU option may not be available in every find implementation on Unix-like systems.
Search only a few directory levels
GNU find supports -maxdepth to cap traversal. For example:
Rank #3
- Used Book in Good Condition
find . -maxdepth 2 -name 'report.txt'
GNU counts the starting directory as depth 0, so a maximum depth of 2 includes that directory and entries at depths 1 and 2. -maxdepth is an implementation-specific option, not a guarantee across all Unix-like systems. Details are in the GNU directory traversal documentation.
Skip a directory subtree
To avoid searching a directory such as .git, use -prune to stop descent into it:
find . -path './.git' -prune -o -name 'report.txt' -print
The expression skips the matching .git path; otherwise, it tests for the requested name and prints matches. Be cautious about combining -prune with -delete: GNU documents that -delete implies depth-first traversal, where -prune cannot prevent descent as intended.
Rank #4
Process matches carefully
Run a command on each result
GNU find can pass matches to another command. The batched form runs the command with as many matched paths as practical:
find . -type f -name '*.txt' -exec command {} +
Review the match expression and results before substituting any command that changes or deletes files. GNU documents security differences between -exec and -execdir; -execdir runs the command from each matched file’s directory and requires a safe PATH containing only absolute directory names. Consult the GNU single-file command reference before using it with sensitive operations.
Pass results through a pipeline
Ordinary newline-separated output can be ambiguous when filenames contain newlines. For bulk processing, use null-delimited output and a consumer that supports it, such as xargs -0:
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutefind . -type f -name '*.txt' -print0 | xargs -0 command
GNU’s multiple-file processing guidance covers null-delimited output and batching.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Quick command reference
| Goal | Command | Notes |
|---|---|---|
| Find an exact basename recursively | find . -name 'report.txt' |
-name matches the basename, case-sensitively. |
| Find regular files by extension | find . -type f -name '*.txt' |
Quote wildcard patterns so the shell does not expand them first. |
| Match without regard to case | find . -iname 'report.txt' |
GNU option; portability varies. |
| Match part of a basename | find . -name '*report*' |
Use -path for a path pattern. |
| Restrict traversal depth | find . -maxdepth 2 -name 'report.txt' |
GNU option; starting path is depth 0. |
| Skip a subtree | find . -path './.git' -prune -o -name 'report.txt' -print |
Do not rely on this pruning behavior with -delete. |
These GNU-specific details follow the GNU Findutils 4.10.0 manual. Other Unix-like systems may ship a different implementation, so check the local find manual when an option is rejected.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

