ops@toolbox:~$ findcommandexamples --run

find Command Examples

find one-liners for real work: by name, size, age, permissions, and safe bulk actions.

CommandWhat it does
find /var/log -name '*.log'Files matching a glob (quote it, or the shell expands first).
find / -iname 'readme*' 2>/dev/nullCase-insensitive name; discard permission-denied noise.
find /srv -type f -size +100MFiles over 100 MB (also: k, G; -size -1M for under).
find /var/log -mtime +30Modified more than 30 days ago. -mtime -1 = last 24h; -mmin -60 = last hour.
find /data -newer /tmp/markerChanged since a reference file, bracket an incident window with touch.
find / -xdev -size +500M -type fStay on one filesystem (-xdev), essential when hunting what filled /.
find /home -type f -perm -o+wWorld-writable files (security sweep). -perm 4000 finds setuid binaries.
find /srv -user www-data -type fOwned by a user. -nouser finds files whose owner no longer exists.
find /tmp -type f -atime +7 -deleteDelete matches. -delete must come LAST; test the expression without it first.
find /var/log -name '*.gz' -mtime +90 -exec rm {} +Batch action: + appends many files per rm invocation (fast); \; runs one per file.
find /etc -name '*.conf' -exec grep -l 'Listen' {} +Which config files contain a string.
find /srv -type f -print0 | xargs -0 chmod 644Null-delimited pipe to xargs, the only safe way when filenames may contain spaces or newlines.
find /data -type d -empty -deleteRemove empty directories (depth-first, so nested empties collapse).
find / -xdev -type f -printf '%s %p\n' | sort -rn | head -20Twenty largest files on this filesystem.

How find thinks

find walks the tree and evaluates an expression against every entry: tests (-name, -size, -mtime) combine with implicit AND, explicit -o for OR, ! for NOT, and actions (-print, -exec, -delete) fire when everything before them matched. Order is evaluation order, which is why -delete written first deletes everything (it matched before your filters ran) and why cheap tests like -name belong before expensive ones. The safety ritual: build the expression, run it printing matches, read the list, then append the destructive action.

Time tests, precisely

The units trip everyone once: -mtime +30 means "more than 30 whole 24-hour periods ago", -mtime -1 "within the last 24 hours", and -mtime 0 "between now and 24h ago". For finer control use -mmin. There are three timestamps, mtime (content changed), ctime (metadata changed: chmod, chown), atime (read; often disabled or lazy via relatime), and cleanup jobs almost always want mtime.

Acting on matches at scale

-exec cmd {} + is the modern default: it batches filenames like xargs, minus the pipe. Reach for -print0 | xargs -0 when you need xargs features like parallelism (-P8). Never pipe unquoted names through plain xargs, one filename with a space or embedded newline and your rm is deleting things you didn't list. And on a full disk, remember deleted-but-open files: if find-and-delete didn't free space, lsof +L1 shows which process still holds the bytes.

Related tools

DNS Record Types
Searchable reference of DNS record types with practical notes.
HTTP Headers Reference
Searchable reference of the HTTP request and response headers that matter in operations.
Linux Signals Reference
kill -9 and friends: every signal a sysadmin meets, with default actions and notes.
tar Command Examples
The tar invocations you actually need: create, extract, list, compress, exclude.