dd if=/dev/zero of=/Users/testmacair/Documents/test.txt bs=1k count=1000 //生成1M大小的文件的方法
注释:
if - File used as stdin
of - File used as stdout
bs - Bytes of a block
count - number of blocks
修改bs和count这两个值可以控制生成文件的大小
源数据是从/dev/zero来的,/dev/zero是Linux下的一个特殊文件,从中读出的字符都是 (ASCII NUL, 0x00)。所以,填充的字节都是0x00。这个是二进制文件,不是文本文件。