Shred Hard Drive Or Partition In Linux And Unix

I always use shred to wipe out USB  memory sticks or memory. The shred command is a GNU tool, available in the coreutils package,  available in many Linux and Unix Systems.

$ dpkg -S /usr/bin/shred
coreutils: /usr/bin/shred

Shred overwrites with zeroes the files or partitions to hide their content and than, deletes them.

Syntax: shred -vz -n 10 /path/to/partition

Some shred command examples:

One:
# shred -n 5 -vz /dev/sda2
Two:
# shred -n 10 -vz /dev/hda1

  • -n value: How many times to overwrite
  • -v : Verbose
  • -z : Overwrite with zeroes

The shred command is slow, if the value after the -n parameter is big.

I have this alias that I use to clean up my usb or memory sticks quickly:

$ alias wipestick='shred -n 1 -vz'
OR, make it persistent, if you are using bash:
$ echo "alias wipestick='shred -n -vz'" >> ~/.bashrc

How to use my alias:

# wipestick /path/to/stick

The shred command can be used to wipe hard drives from a Linux Live CD, such as Ubuntu, Linux Mint, Knoppix or others.

Tagged with: , , , , , , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Subscribe

  

Subscribe to get the latest Linux news and how to guides directly on your e-mail!