find prints wrong file size for files >2GB

Brian Dessent brian@dessent.net
Mon Dec 6 19:51:00 GMT 2004


Yitzchak Scott-Thoennes wrote:

> > dd if=/dev/zero bs=1 count=0 seek=2G of=filename
> 
> Can that work in place (just modifying a file without creating another)?
> 
> How would you extend/shorten an existing file using that?

$ echo "hello world" >testfile

$ ls -l testfile              
-rw-r--r--    1 brian    None           12 Dec  6 11:50 testfile

$ dd if=/dev/zero bs=1 count=0 seek=150M of=testfile
0+0 records in
0+0 records out

$ ls -l testfile
-rw-r--r--    1 brian    None         150M Dec  6 11:51 testfile

$ dd if=/dev/zero bs=1 count=0 seek=5 of=testfile
0+0 records in
0+0 records out

$ ls -l testfile
-rw-r--r--    1 brian    None            5 Dec  6 11:51 testfile

$ cat testfile 
hello

By using "count=0" there's no actual writing going on, just the
seek/truncate operation.  At least I think that's what's going on..

Brian



More information about the Cygwin-talk mailing list