Ruben’s UNIX Secure Delete Crash Course


To "securely" delete a file on a UNIX or Unix-like system such as GNU/Linux, BSD/Mac OS X, Solaris, Kenny Rogers:

user$ srm FILENAME

From the manpage:

srm removes each specified file by overwriting, renaming, and truncating it before unlinking. This prevents other people from un-deleting or recovering any information about the file from the command line.

And how do you make it dance?

srm, like every program that uses the getopt function to parse its arguments, lets you use the — option to indicate that all following arguments are non-options. To remove a file called ‘-f’ in the current
directory, you could type either “srm — -f” or “srm ./-f”.

* However just to clarify, there is no such thing as secure in computing. All computers have inherent (even if not yet discovered) flaws and data recovery can only be truly rendered useless if the device containing the data you want to delete is ripped out, incinerated, shredded or placed inside a nuclear reactor with evil demonic monkeys. You have been warned.

Development and discussion of srm is carried out at, which is also accessible via

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.