coreutils: truncate invocation
1
1 14.5 ‘truncate’: Shrink or extend the size of a file
1 ====================================================
1
1 ‘truncate’ shrinks or extends the size of each FILE to the specified
1 size. Synopsis:
1
1 truncate OPTION... FILE...
1
1 Any FILE that does not exist is created.
1
1 If a FILE is larger than the specified size, the extra data is lost.
1 If a FILE is shorter, it is extended and the extended part (or hole)
1 reads as zero bytes.
1
11 The program accepts the following options. Also see ⇒Common
options.
1
1 ‘-c’
1 ‘--no-create’
1 Do not create files that do not exist.
1
1 ‘-o’
1 ‘--io-blocks’
1 Treat SIZE as number of I/O blocks of the FILE rather than bytes.
1
1 ‘-r RFILE’
1 ‘--reference=RFILE’
1 Base the size of each FILE on the size of RFILE.
1
1 ‘-s SIZE’
1 ‘--size=SIZE’
1 Set or adjust the size of each FILE according to SIZE. SIZE is in
1 bytes unless ‘--io-blocks’ is specified. SIZE may be, or may be an
1 integer optionally followed by, one of the following multiplicative
1 suffixes:
1 ‘KB’ => 1000 (KiloBytes)
1 ‘K’ => 1024 (KibiBytes)
1 ‘MB’ => 1000*1000 (MegaBytes)
1 ‘M’ => 1024*1024 (MebiBytes)
1 ‘GB’ => 1000*1000*1000 (GigaBytes)
1 ‘G’ => 1024*1024*1024 (GibiBytes)
1 and so on for ‘T’, ‘P’, ‘E’, ‘Z’, and ‘Y’.
1
1 SIZE may also be prefixed by one of the following to adjust the
1 size of each FILE based on its current size:
1 ‘+’ => extend by
1 ‘-’ => reduce by
1 ‘<’ => at most
1 ‘>’ => at least
1 ‘/’ => round down to multiple of
1 ‘%’ => round up to multiple of
1
1 An exit status of zero indicates success, and a nonzero value
1 indicates failure.
1