生成具有随机内容的文件的脚本

use*_*389 3 scripts

任何人都可以建议一种编写脚本的方法,该脚本创建一个文本文件,其中填充了完全随机数据12 MB?假设我有兴趣在脚本中创建/home/student/john.bin 仅由随机数据组成的文件,其大小正好是12MB

ama*_*thy 5

dd if=/dev/random of=~/student/john.bin bs=1024 count=12000
或者
dd if=/dev/urandom of~/student/john.bin bs=1024 count=12000

bs您想要的每个随机输入的大小在哪里(1024 = 1Kb),以及count您想要的这些块的数量。

IE。
bs=1024, count=12000: 12MB
bs=512, count=24000: 12MB
bs=256, count=48000: 12MB
等等。