I am using the bash shell and would like to pipe the out of the command openssl rand -base64 1000 to the command dd such as dd if={output of openssl} of="sample.txt bs=1G count=1.
I think I can use variables but I am however unsure how best to do so. The reason I would like to create the file is because I would like a 1GB file with random text.
|
|
||||
|
|
|
It wouldn't be useful here since
1 gigabyte is usually 230 bytes (though you can use Alternatively, you could use
Personally, I would use
|
|||||||||||||||||||||
|
|
Create a 1GB.bin random content file:
|
|||
|
|
|
Try this script.
This script might work as long as you don't mind using
|
|||||||||||||||||||||
|
|
If you want EXACTLY 1GB, then you can use the following: openssl rand -out $testfile -base64 792917038; truncate -s-1 $testfile The openssl command makes a file exactly 1 byte too big. The truncate command trims that byte off. |
|||
|
|