1TRUNCATE(1) User Commands TRUNCATE(1)
2
3
4
6 truncate - shrink or extend the size of a file to the specified size
7
9 truncate OPTION... FILE...
10
12 Shrink or extend the size of each FILE to the specified size
13
14 A FILE argument that does not exist is created.
15
16 If a FILE is larger than the specified size, the extra data is lost.
17 If a FILE is shorter, it is extended and the sparse extended part
18 (hole) reads as zero bytes.
19
20 Mandatory arguments to long options are mandatory for short options
21 too.
22
23 -c, --no-create
24 do not create any files
25
26 -o, --io-blocks
27 treat SIZE as number of IO blocks instead of bytes
28
29 -r, --reference=RFILE
30 base size on RFILE
31
32 -s, --size=SIZE
33 set or adjust the file size by SIZE bytes
34
35 --help display this help and exit
36
37 --version
38 output version information and exit
39
40 The SIZE argument is an integer and optional unit (example: 10K is
41 10*1024). Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,...
42 (powers of 1000). Binary prefixes can be used, too: KiB=K, MiB=M, and
43 so on.
44
45 SIZE may also be prefixed by one of the following modifying characters:
46 '+' extend by, '-' reduce by, '<' at most, '>' at least, '/' round down
47 to multiple of, '%' round up to multiple of.
48
50 Written by Padraig Brady.
51
53 GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
54 Report any translation bugs to <https://translationproject.org/team/>
55
57 Copyright © 2020 Free Software Foundation, Inc. License GPLv3+: GNU
58 GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
59 This is free software: you are free to change and redistribute it.
60 There is NO WARRANTY, to the extent permitted by law.
61
63 dd(1), truncate(2), ftruncate(2)
64
65 Full documentation <https://www.gnu.org/software/coreutils/truncate>
66 or available locally via: info '(coreutils) truncate invocation'
67
68
69
70GNU coreutils 8.32 June 2021 TRUNCATE(1)