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

Re: Creation of empty files [was: Useful use of dd]



On 7/3/21 6:44 AM, Michael Stone wrote:
On Fri, Jul 02, 2021 at 02:30:50PM -0700, David Christensen wrote:
2021-07-02 14:24:30 dpchrist@dipsy ~/sandbox/dd
$ du --bytes truncate-sparse
5242880    truncate-sparse


I expected sparse files, but du(1) does not indicate such (?).

You used --bytes, which per the man page implies --apparent-size


RTFM du(1):

      -b, --bytes
              equivalent to '--apparent-size --block-size=1'


2021-07-03 14:12:30 dpchrist@dipsy ~/sandbox/dd
$ du --block-size=1 [a-z]*
0	dd-sparse
0	truncate-sparse
5242880	urandom
5242880	zero


Thank you.  :-)


I suppose '-b' is Huffman Coding [1] for somebody's use case (?).


I prefer the Principle of Least Surprise [2] -- 'du' means "disk usage".


David


[1] https://en.wikipedia.org/wiki/Huffman_encoding

[2] https://en.wikipedia.org/wiki/Principle_of_least_surprise


Reply to: