srm: securely delete file on Mac OS X Terminal

Open Terminal and at the command prompt type srm. Then drag and drop from a Finder window onto the Terminal window/or type the full path of the file you’d like to delete.

srm /Users/sarang/Desktop/capture.png

Then hit Return to complete the command and erase the file. As with all Terminal commands, if you see no output, then everything has worked fine. Depending on the size of the file, deletion should take no more than a few seconds.

The srm command is intended to be a secure version of the basic rm Unix command. Therefore, securely deleting a directory and its files can be achieved with srm -rf followed by the directory name and path. However, when deleting many files in this way, it’s useful to add the -v (verbose) switch so you get a progress display and can confirm when each file is deleted. In other words, the command for deleting a directory would be srm -rfv .