find Commands
Search for files in a directory tree.All find pages
- find -mtime +7: find and delete files older than N daysfind /path -type f -mtime +7 lists files modified more than 7 days ago; add -delete to remove them. How -mtime rounds days, -mmin, and safe -delete placement.
- find . -empty: find and delete empty files and directoriesfind . -type f -empty lists empty files and -type d -empty empty directories; -delete removes them. Why nested empty folders go too, and how to keep the top.
- find . -name "*.log": find files by name or extensionfind . -name '*.log' finds files by name below a directory; -iname ignores case, -type f limits to files. Why the pattern must be quoted, and acting on results.
- find files larger than 100MB: find . -type f -size +100Mfind . -type f -size +100M lists files bigger than 100 MiB. Sizes round up to whole units (k, M, G), so -size -1M matches only empty files; use -size -1024k.