Powerful find Expressions
Searching by Size (-size)
Specify file size using suffixes:
c: bytesk: KilobytesM: MegabytesG: Gigabytes
Use + for greater than, - for less than.
bash
Find files larger than 50 Megabytes:
$ find /home -size +50M
Searching by Time (-mtime)
Find files based on their modification time (mtime). +N means older than N days; -N means newer than N days.
bash
Find files modified in the last 7 days:
$ find . -mtime -7
Executing Commands on Found Files (-exec)
This is where find gets powerful. You can run a command on every file it finds. The {} acts as a placeholder for the filename, and \; terminates the command.
bash
Find all '.tmp' files and delete them safely:
$ find . -name '*.tmp' -exec rm -i {} ;