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.
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:
Go to Applications > Utilities > Terminal
Type cd .Trash
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.
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.
The steps are as follows:
Restart Mac and quickly press & hold Command + R keys to boot into recovery mode
From the top-menu, go to Utilities > Terminal
Type csrutil disable and hit Return
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:
Boot into macOS recovery mode and launch Terminal
Type csrutil enable and hit Return
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.
Vishal is a data recovery expert @Stellar. He addresses data loss scenarios on a Mac. He intends to help people solve their macOS problems. Besides, Vishal prefers to read autobiographies, and his personal favorite is of Steve Jobs.