truncate.1 (1536B)
- .\" utils-std: Collection of commonly available Unix tools
- .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- .\" SPDX-License-Identifier: MPL-2.0
- .Dd 2024-04-23
- .Dt TRUNCATE 1
- .Os
- .Sh NAME
- .Nm truncate
- .Nd change the size of files
- .Sh SYNOPSIS
- .Nm
- .Op Fl c
- .Fl r Ar ref_file
- .Ar file...
- .Nm
- .Op Fl c
- .Fl s [ Ar + Ns | Ns Ar - Ns | Ns Ar % Ns | Ns Ar / ] Ns Ar size Ns Op Ar suffix
- .Ar file...
- .Sh DESCRIPTION
- .Nm
- changes the size of each given
- .Ar file .
- Either with a size operation given via the
- .Fl s
- option or via a reference file given by
- .Fl r Ar ref_file .
- .Sh OPTIONS
- .Bl -tag -width Ds
- .It Fl c
- Prevent creating new files.
- .It Fl r Ar ref_file
- Set the size of
- .Ar file
- based on the file size of
- .Ar ref_file .
- .It Fl s [ Ar + Ns | Ns Ar - Ns | Ns Ar % Ns | Ns Ar / ] Ns Ar size Ns Op Ar suffix
- Size operation.
- .Bl -tag -width _ -compact
- .It Ar +
- Extend
- .Ar file
- by
- .Ar size
- .It Ar -
- Reduce
- .Ar file
- by
- .Ar size
- .It Ar %
- Round up
- .Ar file
- into a multiple of
- .Ar size ,
- useful for chunks.
- .It Ar /
- Round down
- .Ar file
- into a multiple of
- .Ar size ,
- useful for chunks.
- .El
- .Pp
- .Ar size
- is an integer optionally followed by a
- .Ar suffix
- being one of KMGTP (Kilo, Mega, Giga, Tera, ...) using power of 1024 by default, which can be either explicit via adding iB (like MiB), or turned into powers of 1000 by adding B (like MB).
- .El
- .Sh EXIT STATUS
- .Ex -std
- .Sh SEE ALSO
- .Xr split 1
- .Sh HISTORY
- A
- .Nm
- utility appeared in FreeBSD 4.2.
- .Sh AUTHORS
- .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me