Securely remove files or directories. 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.
The srm command is not required with an SSD drive, a standard erase makes it difficult to recover data from an SSD.
Syntax srm [OPTION]... FILE... Options -d, --directory Ignored (for compatibility with rm(1)) -f, --force Ignore nonexistent files, never prompt -i, --interactive Prompt before any removal -r, -R, --recursive Remove the contents of directories recursively -s, --simple Only overwrite with a single pass of random data -m, --medium Overwrite the file with 7 US DoD compliant passes (0xF6, 0x00, 0xFF, random, 0x00, 0xFF, ran-dom) random) dom) -z, --zero After overwriting, zero blocks used by file -n, --nounlink Overwrite file, but do not rename or unlink it -v, --verbose Explain what is being done --help Display this help and exit --version output version information and exit
srm, like every program that uses the getopt function to parse its arguments, lets you use the --option -option 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".
srm can not remove write protected files owned by another user, regardless of the permissions on the directory containing the file. The -s option overrides the -m option, if both are present. If neither is specified, the 35-pass Gutmann algorithm is used.
“The psychic task which a person can and must set for himself is not to feel secure, but to be able to tolerate insecurity” ~ Erich Fromm
Related macOS commands:
HT201949 - About Disk Utility‘s erase free space feature
rm - Remove files
rmdir - Remove empty folder