Scroll to navigation

srm(1) srm(1)


srm - securely remove files or directories


srm [OPTION]... FILE...


srm removes each specified file by overwriting, renaming, and truncating it before unlinking. This prevents other people from undeleting or recovering any information about the file from the command line. By default srm uses the simple mode to overwrite the file's contents. You can choose a different overwrite mode with --dod, --doe, --openbsd, --rcmp, --gutmann. If you specify more than one mode option, the last option is used.

You can use srm to overwrite block devices. The device node is not removed after overwriting. This feature is available on Linux. Files with multiple hard links will be unlinked but not overwritten.

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

rm -- -f
rm ./-f


ignored (for compatibility with rm(1))
ignore nonexistent files, never prompt
prompt before any removal
remove the contents of directories recursively
when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument. (Not supported on Windows)
Overwrite the file with a single pass of 0x00 bytes. This is the default mode.
OpenBSD compatible rm. Files are overwritten three times, first with the byte 0xFF, then 0x00, and then 0xFF again, before they are deleted.
US Dod compliant 7-pass overwrite.
US DoE compliant 3-pass overwrite. Twice with a random pattern, finally with the bytes "DoE". See for details.
Use the 35-pass Gutmann method. See for details.
Royal Canadian Mounted Police compliant 3-pass overwrite. First pass writes 0x00 bytes. Second pass writes 0xFF bytes. Third pass writes "RCMP". See for details.
explain what is being done. Specify this option multiple times to increase verbosity.
display this help and exit.
output version information and exit.


show current write position and filename handled.


srm can write to block devices on Linux. You can use srm to securely delete an entire hard disk, however you should only do this for classic magnetic drives. The modern solid state disks (SSD) have a faster and better way to erase all contents, Secure Erase. For a Linux operating system see


srm can not remove write protected files owned by another user, regardless of the permissions on the directory containing the file.

Development and discussion of srm is carried out at which is also accessible via See for a general discussion about overwriting data.


1.2.15 Matt Gauthier, Dirk Jagdmann