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

Cacti remote exploit

There appears to be an exploit in the wild which is automating…

Disabling The hald-addon-storage Service On CentOS/RedHat

The hald – Hardware Access Layer Daemon – runs several processes in…

Linux: Mount ISO Image as directory

Here is a handy little shortcut I recently figured out (it took…

Visual.Syntax is my choice for code highlighting

I am using the Visual.Syntax code highlighting plugin by Matthew Delmarter. There…