Skip to content
shellhacks.dev

find Command Builder

Build a find command that matches files by name, type, age, size, owner and permissions, then lists, counts, deletes or runs a command on them.

Free · No sign-up · Your inputs stay in your browser

Input

Build a find command

Output

find command

Command

find /var/www/app/storage/logs -type f -name '*.log' -mtime +14 -print

-delete removes what matches, without asking. Run the same command with -print first and read the list. The order of tests matters only for speed and for -delete, which implies -depth. -exec ... + passes many paths per call; \; runs the command once per file.

Runs in this browser. Nothing you paste is sent to a server.

The everyday ones

Old logs: find /var/log/app -name '*.log' -mtime +14 -delete. Large files: find / -xdev -type f -size +500M. World-writable files: find /var/www -perm -o+w. The tests and actions are described in GNU findutils' manual.

Run it with -print first

-delete acts on everything that matches, immediately, and it implies -depth. A pattern without quotes is expanded by the shell before find sees it, so find . -name *.log can quietly search for the name of one file in the current directory. Run the command with -print, read the list, then swap the action.

Share

Frequently asked questions

What does -mtime +7 mean?
Modified more than 7 days ago, counted in whole 24-hour periods. -mtime -1 is within the last day; -mmin works in minutes.
What is the difference between -exec {} \; and -exec {} +?
\; runs the command once per file; + passes as many files as fit on one command line, which is much faster for large result sets.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Go deeper

Suggested reading

Keep planning

Similar tools