Skip to content
Latchkey

find -size: Find Files by Size

find -size selects files above, below, or at a given size.

When a runner dies with "no space left on device", find -size points straight at the offenders so you can prune them.

What it does

find -size N[unit] matches files of the given size. +N means larger than N, -N means smaller. The unit suffix sets the scale: c is bytes, k is kibibytes, M is mebibytes, G is gibibytes. With no suffix the unit is 512-byte blocks, which surprises people.

Common usage

Terminal
find . -type f -size +100M
find / -type f -size +1G 2>/dev/null
find . -type f -size +50M -exec ls -lh {} +

Options

ExpressionWhat it does
-size +NcLarger than N bytes
-size +NkLarger than N kibibytes
-size +NMLarger than N mebibytes
-size +NGLarger than N gibibytes
-size NExactly N 512-byte blocks (no suffix = blocks)

In CI

To debug a disk-full runner, find / -type f -size +1G 2>/dev/null lists the biggest offenders fast; the 2>/dev/null drops permission noise. Pair with -exec ls -lh {} + or du to see human-readable sizes.

Common errors in CI

A -size query that returns far too many files usually omitted the unit, so N meant 512-byte blocks rather than bytes. Always add c, k, M, or G. On BSD/macOS find the unit letters are the same, but -size only rounds up (a 1-byte file is "1 block"), so very small thresholds behave differently than on GNU.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →