Re: Bug#467378: coreutils: Please include a program to truncate files
From:
Paul Eggert
Subject:
Re: Bug#467378: coreutils: Please include a program to truncate files
Date:
Mon, 25 Feb 2008 15:08:00 -0800
User-agent:
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)
Jim Meyering <address@hidden> writes:
> If you don't mind truncating first, how about this?
>
> true > /var/spool/whatever/foo
> dd bs=1 seek=2G of=/var/spool/whatever/foo < /dev/null
Also, the latter command works even if the former command is omitted.
That is, by itself, that invocation of dd resizes
/var/spool/whatever/foo to 2 GiB, discarding or extending the file as
needed, which is what the original request asked for.