TRUNCATE(1)

πŸ’… TRUNCATE(1) β€” the manual page, but make it cute

okay bestie, welcome to TRUNCATE(1), a General Commands Manual entry, and honestly? she's that girl. this is your one-stop shop for making files bigger or smaller whenever you want. no drama, just math. 🌸


✨ NAME ✨

truncate β€” Shrink or extend the size of each file to the specified size.


🌈 SYNOPSIS 🌈

truncate [OPTION]... [FILE]...

πŸ’– DESCRIPTION πŸ’–

Shrink or extend the size of each file to the specified size. that's it. that's the whole vibe. you point her at some files, you hand her a size, and she makes it happen β€” cutting them down or growing them out, no questions asked. πŸ‘‘


πŸŽ€ OPTIONS πŸŽ€

  • -o, --io-blocks β€” treat SIZE as the number of I/O blocks of the file rather than bytes (so like, block math instead of byte math, iykyk)
  • -c, --no-create β€” do not create files that do not exist (she'll just skip 'em, respectfully πŸ™ˆ)
  • -r, --reference <RFILE> β€” base the size of each file on the size of RFILE (copy her measurements, basically ✨)
  • -s, --size <SIZE> β€” set or adjust the size of each file according to SIZE, which is in bytes unless --io-blocks is specified
  • -h, --help β€” Print help
  • -V, --version β€” Print version
  • <FILE> β€” the file(s). your main characters. 🌟

πŸ”₯ EXTRA πŸ”₯

so SIZE? she's an integer with an optional prefix and an optional unit. iconic range, honestly.

the available units are K, M, G, T, P, E, Z, and Y, and they go like this:

'KB' => 1000 (kilobytes)
'K' => 1024 (kibibytes)
'MB' => 1000*1000 (megabytes)
'M' => 1024*1024 (mebibytes)
'GB' => 1000*1000*1000 (gigabytes)
'G' => 1024*1024*1024 (gibibytes)
note: lowercase-pretty K is the 1024 one, and KB is the 1000 one. do not mix them up bestie, we've all been there. πŸ’€

SIZE may also be prefixed by one of the following, which adjusts the size of each file based on its current size:

'+' => extend by
'-' => reduce by
'<' => at most
'>' => at least
'/' => round down to multiple of
'%' => round up to multiple of

like, she's not just setting a number, she's negotiating with the number that's already there. queen behavior. πŸ’…


⭐ VERSION ⭐

v(uutils coreutils) 0.12.0


πŸ¦‹ EXAMPLES πŸ¦‹

Set a size of 10 GB to an existing file, or create a new file with the specified size:

truncate [-s|--size] 10G path/to/file

Extend the file size by 50 MiB, fill with holes (which reads as zero bytes):

truncate [-s|--size] +50M path/to/file

Shrink the file by 2 GiB, by removing data from the end of file:

truncate [-s|--size] -2G path/to/file

Empty the file's content:

truncate [-s|--size] 0 path/to/file

Empty the file's content, but do not create the file if it does not exist:

truncate [-s|--size] 0 [-c|--no-create] path/to/file
The examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. Please note that, as uutils is a work in progress, some examples might fail.

okay that's the whole page, you're officially a truncate girlie now 🫢 go forth and resize. this was the TRUNCATE(1) manual, dated 2026-09-25, brought to you by v(uutils coreutils) 0.12.0 β€” mwah, love u, bye bestie!! πŸ’œπŸŽ€βœ¨

πŸ“¦ where this page comes from