The idea behind this secure deletion or erasure of your HDD content is basically overwriting every bytes of your disk drive with either zeros or random data. This way, whoever that tries to recover the data, they will only see zeros or gibberish data (random data).
I like to have a thumb drive preloaded with bootable Live Ubuntu USB thumb drive ready to perform tasks like this. For this post, I am not going to cover the topic of how to setup your USB thumb drive with Ubuntu Live OS. The tutorial is ready available at official Ubuntu website.
Once the Ubuntu Live OS is booted up on your PC, there are already built-in commands you can use to perform such secure deletion or erase of your HDD content. There 2 commands that you can use from the Ubuntu Live OS; they are "dd' and "shred".
Note: Assume that your HDD path is "/dev/sda".
Overwrite the whole HDD with random data with "dd" command:
sudo dd if=/dev/urandom of=/dev/sda bs=$((1024*1024))
Overwrite the whole HDD with zeros with "dd" command:
sudo dd if=/dev/zero of=/dev/sda bs=$((1024*1024))
Overwrite the whole HDD with random data with "shred" command:
sudo shred -v /dev/sda
Overwrite the whole HDD with zeros with "shred" command:
sudo shred -v -z /dev/sda
Note: By default shred will run 3 iterations to overwrite the HDD with random data or zeroes. To control the iteration, use the "-n" argument.
References, Sources and Credits: