1. Home
  2. Mac OS X
  3. How to permanently delete a single file from mac using terminal

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

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.


  1. This article is incorrect.

    The -r switch refers to recursively deleting files with the folder to be deleted. As in, it deletes all files and sub directories within the main folder to be deleted.

    The -f switch has nothing to do with folders. This is a ‘force’ command and will ignore nonexistent files, never prompt, ignores permissions etc.

    Type “man rm” (no quotes) when in terminal, this will explain what the switches do.

  2. 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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.