Skip to content

Instantly share code, notes, and snippets.

@anikolaienko
Last active January 21, 2022 10:38
Show Gist options
  • Save anikolaienko/75f0b25ec9373f5bdf0c6045c021271f to your computer and use it in GitHub Desktop.
Save anikolaienko/75f0b25ec9373f5bdf0c6045c021271f to your computer and use it in GitHub Desktop.
Bash: Generate random content large file

Size:

  • 2**10 - 1 KB
  • 2**20 - 1 MB
  • 2**30 - 1 GB

1) Using openssl util

use -base64 flag to generate readable content

openssl rand -out sample.txt $(( 2**25 ))

2) Using built-in '/dev/urandom' preudorandom string generator

dd if=/dev/urandom of=sample1.txt bs=$(( 2**25 )) count=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment