从Patrix的链接回答 这里 。
DD
创建1GB的二进制文件
dd if=/dev/urandom of=sample.bin bs=64m count=16
给
这是联系的答案首选,但在我的Macbook Air 2013年中期Yosemite 10.10.3上的记录很慢 1073741824 bytes (1.1 GB) copied, 116.436 s, 9.2 MB/s
。
OpenSSL的
以下命令更快,但不创建二进制文件
openssl rand -out sample.txt -base64 $(( 2**30 * 3/4 ))
给
head sample.txt
3WqdfYDB8XejIk2VzdsLJ8SuxNhH/oCJ8mKXbrsVmT5uZaCGmW7YZN3PAbY9lVqc
0Tr2sX4RXlJ5PUzujJ2SUf/xjI3peTlpEYTnxJKiDS4CDo+TBskVBgiE2/J8+9Cy
CcSnkkuHLJgTCxqj9tYB3e3bkzIMu6LvcvjUQR2p8IYl7zBLG+fyYZvHsKT85XVV
NaDKbCQ3xLLAXXd2mtIHpjgEDuvrMrTXEJpvgSveBJteyw27FRjwNA+kG5cdgFbd
rIZORF4HT4fBiPdwOQ8+bWn0qR4xugLC+RNjMH8MCBSb4QiEGisEigZxezqnUYlv
mZAs9afD0H5UpXHMU75jcyWzEgrJPj6L0uVyFuR59mFI2mNGqW2P926rifd2j1Da
ETvnT/5KybfjSfanpLmbaEbb4CjRW056ZCeZnp4oWiwFBmajGdwFiOXOtCnDn2El
YWaNK0a8LwrLMNKCbjk+rlpy/3MRm50DAcAR6UwDbAPcusEcNtfDJxdon3/HZfFy
Z4kp9VhUfhqVibcf5LwYhOa3bfLVwIPRZDKrP5cv0vNBz0ajB9MGnTaDSeDLgzRs
L5ayb2H6s02HAR+ilRQkOxpXYetaqMVMHuI1mIO0yvbLZdq1FmtTAN3rRXdn0ENN
要么
xxd sample.txt | head -10
0000000: 3357 7164 6659 4442 3858 656a 496b 3256 3WqdfYDB8XejIk2V
0000010: 7a64 734c 4a38 5375 784e 6848 2f6f 434a zdsLJ8SuxNhH/oCJ
0000020: 386d 4b58 6272 7356 6d54 3575 5a61 4347 8mKXbrsVmT5uZaCG
0000030: 6d57 3759 5a4e 3350 4162 5939 6c56 7163 mW7YZN3PAbY9lVqc
0000040: 0a30 5472 3273 5834 5258 6c4a 3550 557a .0Tr2sX4RXlJ5PUz
0000050: 756a 4a32 5355 662f 786a 4933 7065 546c ujJ2SUf/xjI3peTl
0000060: 7045 5954 6e78 4a4b 6944 5334 4344 6f2b pEYTnxJKiDS4CDo+
0000070: 5442 736b 5642 6769 4532 2f4a 382b 3943 TBskVBgiE2/J8+9C
0000080: 790a 4363 536e 6b6b 7548 4c4a 6754 4378 y.CcSnkkuHLJgTCx
0000090: 716a 3974 5942 3365 3362 6b7a 494d 7536 qj9tYB3e3bkzIMu6
或者你跑
openssl rand -out sample.bin $(( 2**30 * 3/4 ))
它使用完整的字节范围创建文件
xxd sample.bin | head -10
0000000: 9084 48bf dc6c 21d3 579f 6153 6b3d e62f ..H..l!.W.aSk=./
0000010: 9460 0228 5e1e b531 3bb4 223a 120b 0273 .`.(^..1;.":...s
0000020: 27e2 de7c b9e8 63b8 6333 9702 05cc 2fe1 '..|..c.c3..../.
0000030: 5aab fed9 1732 246d 59c8 de14 6b04 907d Z....2$mY...k..}
0000040: f164 81c4 7065 9798 71b7 891b dbe1 f06b .d..pe..q......k
0000050: 24ad 9749 b596 4dad a4a9 b415 64a7 6ccb $..I..M.....d.l.
0000060: 8463 a125 9abe 9a7b 7f70 f3ea 9acf 1eb0 .c.%...{.p......
0000070: ebe0 9f0d 87dd ffce 4e20 9793 eda8 1872 ........N .....r
0000080: f08a 3aa3 d3e7 5bca 6b84 b44d 1650 4b9e ..:...[.k..M.PK.
0000090: 282f c9c3 1e8c b423 472e 857c 134e 18ca (/.....#G..|.N..
/dev/random
并将其分发给所有涉及的系统?或者(如果无法分发)使用短shell / perl / ruby脚本在各种系统上生成相同的文件?