/dev/urandom | Cheatsheet
Populating files with random data
Create several files filled with random data
for fileSize in 1 10 50 100 250 500 1000; do
echo "Creating file: ${fileSize}M";
sudo head -c ${fileSize}M </dev/urandom >${fileSize};
done
Create a file with random data via openssl
head -c 50M </dev/urandom >50MB
Create a file with random data via openssl
openssl rand -out sample.txt -base64 $(( 2**30 * 3/4 ))
Create a file with random data via openssl
openssl rand -base64 1000 \
|dd of=sample.txt bs=1G count=1
Create a file with random data via head
head -c 50M </dev/urandom >50MB
Create a file with random data via head
head -c 1073741824 </dev/urandom >myfile
Create a file with random data via fallocate
fallocate -l 100KB dummy_100KB_file
Create a file with random data via head
< /dev/urandom tr -dc "\t\n [:alnum:]" \
| head -c1000 > file.txt