Howto erase your files/partition with shred in linux

Submitted by rex on Wed, 12/30/2009 - 21:03

if you want to erase a file use just the command


shred -v filename

its ok if you erase your file one time. if you want to erase your file multi times use the -n parameter.

you overrite with the command the file 2 times.

shred -v -n 2 filename

to erase your partition use fdisk to show your partition


rex@linux:~$ sudo fdisk -l

Platte /dev/sda: 1500.3 GByte, 1500301910016 Byte
255 Köpfe, 63 Sektoren/Spuren, 182401 Zylinder
Einheiten = Zylinder von 16065 × 512 = 8225280 Bytes
Disk identifier: 0x00000001

Gerät boot. Anfang Ende Blöcke Id System
/dev/sda1 * 1 13 102400 7 HPFS/NTFS
Partition 1 endet nicht an einer Zylindergrenze.
/dev/sda2 13 16708 134102016 7 HPFS/NTFS
Partition 2 endet nicht an einer Zylindergrenze.
/dev/sda3 16709 182401 1330922880 5 Erweiterte
Partition 3 endet nicht an einer Zylindergrenze.
/dev/sda5 16709 17316 4876168+ 82 Linux Swap / Solaris
/dev/sda6 17316 35552 146482528+ 83 Linux
/dev/sda7 35553 182401 1179564088+ 7 HPFS/NTFS

Platte /dev/sdf: 82.3 GByte, 82348277760 Byte
255 Köpfe, 63 Sektoren/Spuren, 10011 Zylinder
Einheiten = Zylinder von 16065 × 512 = 8225280 Bytes
Disk identifier: 0x46894688

Gerät boot. Anfang Ende Blöcke Id System
/dev/sdf1 * 1 6530 52452193+ 7 HPFS/NTFS
/dev/sdf2 6531 10010 27953100 f W95 Erw. (LBA)
/dev/sdf5 6531 10010 27953068+ 7 HPFS/NTFS

The computer has 2 Harddisks
sda - 1500 GB
sdf - 80 GB

to erase the whole disk use:

sudo shred -v -n 2 /dev/sdf

to erase the first partition use

sudo shred -v -n 2 /dev/sd1

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.