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

Comprehensive .htaccess guide

The AskApache blog has a great comprehensive guide to .htaccess. A must…

PowerDNS flexible, fast DNS Server

I’ve recently been testing/installing PowerDNS for a web hosting provider. Man am…

Permissions error while using system MySQL folder and Docker

Recently I ran into a permissions issue when running MySQL in a docker container and using a local host’s directory with a restore of a MySQL. The fix for this is an easy one, once you know where to look.

Remote Desktop from Windows XP to Windows Server 2008 or Windows Vista

The Remote Desktop connection settings for Windows Server 2008, and I believe…