14387 shaares
5333 private links
5333 private links
openssl rand -out sample.txt -base64 805306368
Alternatively, you could use /dev/urandom, but it would be a little slower than OpenSSL:
dd if=/dev/urandom of=sample.txt bs=1G count=1
Personally, I would use bs=64M count=16 or similar:
dd if=/dev/urandom of=sample.txt bs=64M count=16
//
Since, your goal is to create a 1GB file with random content, you could also use yes command instead of dd:
yes [text or string] | head -c [size of file] > [name of file]
Sample usage:
yes 'this is test file' | head -c 100KB > test.file