bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug#467378: coreutils: Please include a program to truncate files


From: Jim Meyering
Subject: Re: Bug#467378: coreutils: Please include a program to truncate files
Date: Mon, 25 Feb 2008 19:05:32 +0100

Russell Coker <address@hidden> wrote:
> On Monday 25 February 2008 22:11, Jim Meyering <address@hidden> wrote:
>> > One non-obvious feature request that I have is for a truncate on a
>> > non-existant file to create it (similar to the way "touch" is commonly
>> > used to create files).
>>
>> The obvious question is then "Why?"
>
> One specific case is where I want a large sparse file to exist - which may
> have been created previously.  So "truncate 2g /var/spool/whatever/foo" would
> make that file exist and be 2g in size regardless of whether it was there
> before.

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]