2 .\" Copyright (c) 2000 Sheldon Hearn <sheldonh@FreeBSD.org>.
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" $FreeBSD: src/usr.bin/truncate/truncate.1,v 1.4.2.7 2001/08/16 13:17:08 ru Exp $
33 .Nd truncate or extend the length of files
56 utility adjusts the length of each regular file given on the command-line.
58 The following options are available:
59 .Bl -tag -width indent
61 Do not create files if they do not exist.
64 utility does not treat this as an error.
65 No error messages are displayed
66 and the exit value is not affected.
68 Truncate files to the length of the file
79 argument is preceded by a plus sign
81 files will be extended by this number of bytes.
84 argument is preceded by a dash
86 file lengths will be reduced by no more than this number of bytes,
87 to a minimum length of zero bytes.
90 argument specifies an absolute length to which all files
91 should be extended or reduced as appropriate.
95 argument may be suffixed with one of
100 to indicate a multiple of
101 Kilobytes, Megabytes or Gigabytes
109 options must be specified.
111 If a file is made smaller, its extra data is lost.
112 If a file is made larger,
113 it will be extended as if by writing bytes with the value zero.
114 If the file does not exist,
115 it is created unless the
120 while truncating a file causes space on disk to be freed,
121 extending a file does not cause space to be allocated.
122 To extend a file and actually allocate the space,
123 it is necessary to explicitly write data to it,
124 using (for example) the shell's
126 redirection syntax, or
131 If the operation fails for an argument,
133 will issue a diagnostic
134 and continue processing the remaining arguments.
142 utility conforms to no known standards.
146 utility first appeared in
151 utility was written by
152 .An Sheldon Hearn Aq Mt sheldonh@starjuice.net .