The truncate command
shrink or extend the size of a file to the specified size 1 example from the lessons of the IVski Linux Playground — try them in the terminal next to them.
Options in the examples
-s, --size=SIZE- set or adjust the file size by SIZE bytes
Examples
sudo truncate -s 0 /var/log/huge.logEmpty a log file without deleting it (keeps the file handle valid)