TRUNCATE(1)

๐ŸŒธ NAME ๐ŸŒธ

truncate โ€” shrink or extend the size of a file to the specified size, bestie ๐Ÿ’–


โœจ SYNOPSIS โœจ

truncate OPTION... FILE...

๐Ÿ’… DESCRIPTION ๐Ÿ’…

Okay so here's the tea โ˜•: truncate shrinks or extends the size of each FILE to the size you told it. That's it. That's the whole job. Iconic, honestly.

A FILE argument that does not exist? Yeah, it gets created. New file, who dis ๐ŸŽ€

If a FILE is larger than the size you specified, the extra data is lost โ€” like, gone gone, no takebacks ๐Ÿ˜ญ. If a FILE is shorter, it gets extended, and the sparse extended part (the hole ๐Ÿ•ณ๏ธ) reads as zero bytes. Free real estate, but make it zeroes.

Mandatory arguments to long options are mandatory for short options too. Yes bestie, if it's required long, it's required short. No shortcuts on the shortcuts ๐Ÿ™ˆ
  • -c, --no-create โ€” do not create any files. Chill. Just don't make anything new โœ‹
  • -o, --io-blocks โ€” treat SIZE as a number of IO blocks instead of bytes. Different unit, same drama ๐Ÿงš
  • -r, --reference=RFILE โ€” base the size on RFILE. Copy her measurements, periodt ๐Ÿ‘‘
  • -s, --size=SIZE โ€” set or adjust the file size by SIZE bytes. The main character option fr fr ๐Ÿ’…
  • --help โ€” display this help and exit. Your little cheat sheet ๐Ÿซถ
  • --version โ€” output version information and exit. Receipts, always ๐Ÿงพ

๐Ÿฆ‹ THE SIZE ARGUMENT ๐Ÿฆ‹

The SIZE argument is an integer plus an optional unit (example: 10K is 10*1024). Units are K,M,G,T,P,E,Z,Y,R,Q (powers of 1024) or KB,MB,... (powers of 1000). Binary prefixes can be used, too: KiB=K, MiB=M, and so on. It's giving very thorough, and we love that for her ๐ŸŒˆ

SIZE may also be prefixed by one of the following modifying characters:

  • '+' โ€” extend by
  • '-' โ€” reduce by
  • '<' โ€” at most
  • '>' โ€” at least
  • '/' โ€” round down to multiple of
  • '%' โ€” round up to multiple of

๐ŸŽ€ AUTHOR ๐ŸŽ€

Written by Padraig Brady. King behaviour, no cap ๐Ÿ‘‘


๐Ÿ’œ REPORTING BUGS ๐Ÿ’œ

Found a bug? Tell the girlies:


Copyright ยฉ 2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.

This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. (Read that again bestie โ€” no warranty, fr fr ๐Ÿ’€)


๐ŸŒธ SEE ALSO ๐ŸŒธ

Full documentation <https://www.gnu.org/software/coreutils/truncate> or available locally via: info '(coreutils) truncate invocation' โ€” iykyk ๐Ÿ“–


GNU coreutils 9.12, dated September 2026 โ€” that's the whole TRUNCATE(1) vibe check, bestie. Go resize something responsibly, mwah ๐Ÿ’‹โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from