100 Useful Command-Line Utilities

by Oliver; 2014

11. shred

Securely remove your file by overwritting then removing:
$ shred -zuv file	# removes a file securely
			# (flags are: zero, remove, verbose)
For example:
$ touch crapfile  # create a file
$ shred -zuv crapfile 
shred: crapfile: pass 1/4 (random)...
shred: crapfile: pass 2/4 (random)...
shred: crapfile: pass 3/4 (random)...
shred: crapfile: pass 4/4 (000000)...
shred: crapfile: removing
shred: crapfile: renamed to 00000000
shred: 00000000: renamed to 0000000
shred: 0000000: renamed to 000000
shred: 000000: renamed to 00000
shred: 00000: renamed to 0000
shred: 0000: renamed to 000
shred: 000: renamed to 00
shred: 00: renamed to 0
shred: crapfile: removed
As the man pages note, this isn't perfectly secure if your file system has made a copy of your file and stored it in some other location. Read the man page here.

<PREV   NEXT>