truncate Command Examples

Shrink or extend the size of a file to the specified size. More information: https://www.gnu.org/software/coreutils/manual/html_node/truncate-invocation.html.

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

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

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

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

truncate {{[-c|--no-create]}} {{[-s|--size]}} 0 {{path/to/file}}