find -printf: custom-formatted output with size and date

Use GNU find's -printf to print paths, sizes and timestamps in any layout, ready for sorting or scripts.

LinuxscriptingformatfindLow risk
Run find . -type f -printf '%s %p\n' (or with %T directives for dates) to emit exactly the fields you need.

01Command

Command
$ find . -type f -printf '%TY-%Tm-%Td %10s %p\n' | sort -r

02What it does

-printf is GNU find's best-kept secret: instead of piping through ls or stat, you choose the fields directly — %s size in bytes, %p path, %TY-%Tm-%Td formatted mtime, %u/%g owner, %m octal mode. The output is one cleanly delimited record per file, so it sorts, cuts and parses reliably. This makes one-liners like 'largest 10 files' trivial without spawning a process per file.

03Risk

RiskLow risk
!Warning: -printf is a GNU extension and does not exist in BSD/macOS find; note that %s is bytes, not human-readable.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • find(1) — Arch Linux manual
    Arch Linux · technical · 2026-09-17
    Evidence: GNU find -printf directive table including %s, %p, %T* time format directives
  • find(1) — Linux manual page
    man7.org · technical · 2026-09-17
    Evidence: -printf format: documents %s size, %p filename, %T@/%TY mtime directives and the whole -printf formatting language

Last verified: 2026-09-17 · Category: Files & Folders

06Related solutions