How to Restore Files Deleted from Trash by Using Terminal? Myth Busting Blog

This blog busts the myth—Terminal can recover the files deleted permanently from Trash. Read on to know the situations wherein Terminal can perform data recovery for Mac. And, also find out how to recover the data that’s permanently deleted from Trash.

Figure 1: Can Terminal Restore Permanently Deleted Files?

If after selecting one or more files you drag and drop them to Trash, hit the Delete key, or use the Delete option from the context menu, then macOS deletes these files instantly from the current folder and moves them to Trash.

You can straightaway use Command + Z key to undo the delete operation. Otherwise, later you can go to Trash, select those deleted files, secondary click, and choose Put Back to restore the files from the Trash.

You can even do the same file restoration task by using macOS Terminal—the steps are as follows:

  1. Go to Applications > Utilities > Terminal
  2. Type cd .Trash
  3. Type ls
  4. Type mv filename ../

Here you should replace filename with the name of the deleted file present inside Trash. The cd command changes the directory to the hidden Trash folder, the ls command lists all files in the Trash folder, and mv command moves the specified file to the home directory. Now, you just need to navigate to the home directory to access your restored files.

For instance, in the below screenshot, the mountain.fuji.jpg file (which is deleted temporarily) is restored back to the Desktop.

Figure 2: Terminal restored temporarily deleted file.

But the Terminal utility doesn’t work in case you have emptied the Trash, deleted the files from Trash, used Permanently Delete context menu option, or pressed Option + Shift + Command + Delete keys. This is because references of deleted files are lost from Trash once you perform any of the aforementioned operations.

Inference: Although you can use Terminal to restore deleted files when their reference is present in the Trash, it is not possible to restore the files that you have deleted from Trash using Terminal. And, hence, this debunks the myth that Terminal can recover files deleted from Trash.

If you cannot restore files deleted from Trash using Terminal, then the question arises is there any method to restore those permanently deleted files.

How to Recover Permanently Deleted Files from Trash?

Stellar Data Recovery Professional for Mac is a widely used software for recovering permanently deleted files from Trash. The software recovers data on all types of Mac devices viz. MacBook Air, MacBook Pro, iMac, iMac Pro, Mac Pro, and Mac mini. Download the free trial version of the software from the below:


To recover permanently deleted data in case of macOS Mojave or High Sierra, first, disable the system integrity protection or SIP by using Terminal.

Figure 3: Enable and Disable System Integrity Protection Safely

The steps are as follows:

  1. Restart Mac and quickly press & hold Command + R keys to boot into recovery mode
  2. From the top-menu, go to Utilities > Terminal
  3. Type csrutil disable and hit Return
  4. Restart Mac from the Apple menu

To restore files deleted from Trash, see the following video on how to use Stellar Data Recovery Professional for Mac.

Once the recovery process is over, enable the system integrity protection by using Terminal in the same way as above:

  1. Boot into macOS recovery mode and launch Terminal
  2. Type csrutil enable and hit Return
  3. Restart Mac from the Apple menu


The blog debunked the myth that Terminal can restore the files that are deleted from Trash. In reality, it restores only those deleted files that are present in the Trash. In case you have emptied the Trash or deleted files from the Trash, then Terminal data recovery is useless. You would need a Mac data recovery software to get back the permanently deleted data.

  1. Kirk Fletcher August 23, 2019
    • Vishal August 27, 2019
  2. Carolyn Cunningham January 24, 2019
    • Vishal January 25, 2019

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.