It is very easy to create a random file using the linux command line. Much like the command to fill a file with all zeros, for example a 1 Meg file:

dd if=/dev/zero of=zero.filename bs=1024 count=1000

You do the same using /dev/urandom:

dd if=/dev/urandom of=random.filename bs=1024 count=1000

Resulting in a 1MB file:

1000+0 records in
1000+0 records out
1024000 bytes (1.0 MB) copied, 0.0294247 s, 34.8 MB/s

This is transferring random data from the virtual device urandom to the output file. We use /dev/urandom instead of /dev/random because the /dev/random source generates random data very slowly. urandom is much faster at this but remains very random, if not quite a random as /dev/random. This should work with any system with dd and /dev/urandom.

1 comment
  1. Pingback: Dave Drager

Comments are closed.

You May Also Like

Using Ubuntu as a 24/7 Lobby Display Driver

I recently took upon the task of setting up a presentation display…

Problem installing PECL PHP extensions while /tmp is secured

I recently tried to install a PHP PECL extension on a server…

Printing to a shared printer from DOS

If you or your client is using an old-DOS based program to…

Clearing spamassassin BAYES filter tokens

I recently had a problem where my Spamassassin install started thinking that…