How To Permanently Delete A Single File From Mac Using Terminal [Tip]

Advertisement

A very basic thing to do, but still not commonly known, is how to delete a single file permanently from your Mac. Moving a file to Trash means it’s still there and can be restored any time, not to mention eating up precious space. The slight problem with Trash is that if you want to remove a particular file from it, i.e., permanently delete it, you have to remove all of them. In the event you have just a single file to remove (wipe permanently off the face of your hard drive and the earth itself), you go to the Terminal and execute the simplest of commands.

Open Terminal, type “rm”  (no quotes, but there should be a space after it). Drag & drop the file you want to remove onto the Terminal window, and its path will be added at the end of the command, then hit Return. Your file will be removed beyond recovery.

permanently remove file

This tip works for any and all files types and sizes, and is literally irreversible. Be extra cautious when using the command, and better if you use it only sparingly. To delete files of low priority, use Trash, which gives you some allowance for recovering a file if it was removed by accident.

For folders, use the command “rm –rf” followed by the path to the folder. Enter the command without quotes. Your folder and every single file in it will be removed permanently. This command is really the same one for deleting files, but modified slightly to tell Terminal that you want to remove a folder. It will have the same permanent effect mentioned when deleting a file, so proceed with caution.

Advertisement
  • Lee

    I can’t seem to get this working with a folder

    • rahulm4sm

      she has given a different command for folder, read full article….., its “rm -rf “

  • Comment before me: tribute to the intelligence of the average mac user. You can’t even use one of the simplest terminal commands there are.