find <dir> -name "<pattern>"Finds files whose name matches a glob (case-sensitive).
Example
find /etc -name "*.conf"Searches the directory tree by name, type, size, time, owner or permissions — and runs actions on matches.
sudo apt install findutilsfind <dir> -name "<pattern>"Finds files whose name matches a glob (case-sensitive).
Example
find /etc -name "*.conf"find <dir> -iname "<pattern>"Case-insensitive name match; 2>/dev/null hides permission errors.
Example
find / -iname "*backup*" 2>/dev/nullfind <dir> -type fFiles only. Use -type d for directories and -type l for symlinks.
Example
find /var/www -type ffind <dir> -maxdepth <n> -name "<pattern>"Limits how deep the search goes.
Example
find . -maxdepth 2 -name "*.py"find <dir> -path "<pattern>" -prune -o -name "<name>" -printSkips a directory tree entirely.
Example
find . -path ./node_modules -prune -o -name "*.js" -printfind <dir> -size +<n>Files larger than a size (k, M, G). Use - for smaller.
Example
find / -type f -size +500M 2>/dev/nullfind <dir> -emptyEmpty files and directories.
Example
find /tmp -emptyfind <dir> -mtime -<n>Modified in the last n days.
Example
find /etc -mtime -1find <dir> -mmin -<n>Modified in the last n minutes — useful when investigating a recent compromise.
Example
find /var/www -mmin -30find <dir> -newer <file>Files modified more recently than a reference file.
Example
find / -newer /tmp/marker -type f 2>/dev/nullfind <dir> -newermt "<date>"Files modified between two dates.
Example
find /home -newermt "2026-11-01" ! -newermt "2026-11-03"find / -perm -4000 -type f 2>/dev/nullLists SUID binaries. Compare against GTFOBins for privilege-escalation paths.
find / -perm -2000 -type f 2>/dev/nullLists SGID binaries.
find / -writable -type d 2>/dev/nullDirectories your current user can write to.
find / -perm -o+w -type f ! -path "/proc/*" 2>/dev/nullWorld-writable files outside /proc.
find <dir> -user <user>Files owned by a user.
Example
find / -user www-data -type f 2>/dev/nullfind / -nouser -o -nogroup 2>/dev/nullFiles whose owner or group no longer exists.
find <dir> -name "<pattern>" -exec <cmd> {} \;Runs a command on each result.
Example
find . -name "*.log" -exec gzip {} \;find <dir> -name "<pattern>" -exec <cmd> {} +Passes many results to one command invocation — much faster.
Example
find . -name "*.txt" -exec grep -l "secret" {} +find <dir> -name "<pattern>" -deleteDeletes matches. Run without -delete first to check what will go.
Example
find /tmp -name "*.tmp" -mtime +7 -deletefind <dir> -type f -print0 | xargs -0 <cmd>Safely handles names with spaces or newlines.
Example
find . -type f -print0 | xargs -0 sha256sumfind <dir> -type f -printf "%T@ %p\n" | sort -n | tailLists the most recently modified files (GNU find).
Example
find /var/www -type f -printf "%T@ %p\n" | sort -n | tailSearches text for lines matching a pattern, with regular expressions, recursion and context.
Builds and runs command lines from standard input — the glue for batch operations and parallel jobs in pipelines.
Lists directory contents with sizes, permissions, owners, timestamps and hidden files.
Changes file permissions using symbolic or octal modes, including setuid, setgid and sticky bits.
Estimates how much space files and directories use — find what is filling a disk.
Removes files and directories. There is no recycle bin — deletion is immediate.