Truncate files to zero length

Posted Over 12 years ago. Visible to the public.

This will reduce the filesize of foo and bar to 0 bytes:

truncate -s0 foo bar

If the files do not exist they will be created.

You can use this to easily truncate your application's log files:

truncate -s0 log/*.log
Arne Hartherz
Last edit
Over 5 years ago
Dominik Schöler
Keywords
linux, unix, shell
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2011-09-20 14:38)