Skip to content

truncate

Shrink or extend the size of a file to the specified size


Create a file of a given size in linux

truncate -s 1M file

Create arbitrary big file full of zeroes but done in a second

truncate --size 1G bigfile.txt

Empty a file

truncate -s 0 file.txt