Generating file with ASCII numbers using /dev/urandom

asciirandom

How can I generate 10 MB files from /dev/urandom filled with:

  • ASCII 1s and 0s

  • ASCII numbers between 0 and 9

Best Answer

  • ASCII numbers between 0 and 9

    < /dev/urandom tr -dc '[:digit:]' | head -c 10000000 > 10mb.txt
    
  • ASCII 1s and 0s

    < /dev/urandom tr -dc 01 | head -c 10000000 > 10mb.txt
    
Related Question