Securely erasing files

There's a utility within coreutils of Linux called "shred".  It's a great tool for securely erasing files from your hard disk, or even securely erasing your hard disk.  I've provided a couple of examples here.

shred -zvu filename

The above command, will shred the file named "filename".  The "z" parameter writes zeros at the end, to hide the shredding process.  The "u" parameter ensures that the file is deleted after it has been shredded, otherwise it leaves the file entry on the disk, but no contents within it.  The "v" parameter is verbose mode so that you can see and watch the process, otherwise you won't see any update on your screen.  This particular command, uses a default overwrite of 25 times.  The command below, is similar, except it only overwrites 10 times.

 shred -zvu -n10 filename

If you wanted to do a whole hard disk for example, then:

shred -zv -n5 /dev/hda

would overwrite the whole hard disk 5 times.  Although it would be probably be recommended to do more just to make sure :-)