0

I have used /dev/zero and /dev/random to generate files of certain size. However, is there a way to control variability of generated files?

I would like to create few files that would have same uncompressed size, but different compressed size (compression ratio).

2

1 Answer 1

2

Quick and dirty:

cat /dev/urandom | tr -dc 'abcd' | dd count=10 bs=1 2>/dev/null

generates 10 bytes of (pseudo-)random sequence out of a, b, c, and d. Modify the alphabet (here "abcd") to get other compression rates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.