Rain Wiki · Linux

Finding large and old files with find

How to use find to list big or old files on Linux, preview them safely and delete only what you checked.

Linux · Rain Wiki

find is the standard Linux command that searches a directory tree for files matching conditions such as size, age, name or type. 'find / -xdev -type f -size +1G' lists files larger than 1 GB on the root file system, which is often the fastest way to see what suddenly filled a disk.

Useful tests

-size +500M (larger than 500 MiB), -mtime +30 (modified more than 30 days ago), -name '*.log', -type f (files only), -xdev (do not cross into other file systems).

Showing sizes

Add '-exec ls -lh {} +' to see sizes, or use GNU find's -printf, for example -printf '%s %p\n', and sort the output.

Deleting safely

-delete removes every match immediately. Run the same command without -delete first, read the list, then add -delete as the last option.

How to find files over 1 GB

  1. Run: sudo find / -xdev -type f -size +1G -exec ls -lh {} +
  2. Identify each file's owner program before removing it.
  3. For old logs, preview: sudo find /var/log -type f -name '*.gz' -mtime +30
  4. Only then delete: sudo find /var/log -type f -name '*.gz' -mtime +30 -delete

Cautions

  • Placing -delete before the tests deletes everything under the path.
  • Database, virtual-disk and swap files are large on purpose: do not delete them.

Sources

Last updated: 2026-10-08

Related articles