If you are familiar with command lines, you may prefer to perform tasks with Mac Terminal, because it allows you to make changes on your Mac quickly. One of the Terminal’s useful features is to recover deleted files and here we will focus on the step-by-step guide to recover files or folders using Mac Terminal.
Also, we have some Terminal recovery basics for you, so you can decide when and how to use Terminal for a higher recovery rate. Moreover, we offer solutions when Terminal not working in some cases, like restoring files permanently deleted by Terminal RM command.
Terminal is a command-line-based application on macOS. With a collection of command shortcuts, you can perform different tasks on your Mac quickly and efficiently without repeating certain actions manually.
Mac Terminal can be utilized to launch an application, open a file, copy files, download files, change location, change file type, delete files, recover files, etc.
Mac Terminal can delete files with rm command. You just need to type “rm” in Terminal and leave a space, then drag a file to Terminal and press Enter key to delete it. But you won’t be able to retrieve this deleted file from Trash Bin after running RM command on your Mac, because Terminal RM deletes a file permanently, there is no way to revert, unless you have installed a professional data recovery program.
No, Mac Terminal CANNOT recover a permanently deleted file.
It can delete a file permanently, but speaking of recovery, Terminal only applies to recovering files moved to Mac Trash Bin. Besides, you can't recover deleted files using Mac Terminal in following cases:
Therefore, if you have got permanently deleted files out of these situations, Terminal will be of no help, continue to read for finding other solutions in next part. While if the deleted files still remain in Trash Bin, in part 4, follow the steps to access Trash from Terminal on Mac.
How to recover emptied Trash on Mac? How to recover files deleted by Terminal RM command in Mac? How to recover permanently deleted files on Mac without Terminal? No worries, here a satisfying answer will be offered by sharing 2 data recovery options.
The easiest and most reliable solution to recover files permanently deleted with Terminal RM command line on Mac, is using Cisdem Data Recovery for Mac.
Cisdem is a professional-grade data recovery program to effortlessly restore Trash-emptied, deleted, lost and formatted files from both internal and external drives. For example, it can get back files from Mac internal hard drive, external hard disk, USB, SD Card, media players, etc.
It’s a versatile tool to read and recover 200+ types of files, including videos, audios, photos, documents, emails, archives and more. Equipped with modern interface, fast scanning, high recovery rate, Cisdem Data Recovery always helps users to deal with a wide range of data loss scenarios, without the need of specialized knowledge on data retrieval.
Although we can’t restore permanently deleted files using Mac Terminal alone, it’s achievable by using a data recovery application based on Terminal. Such app we recommend is PhotoRec, and don’t be misled by its name. In addition to photos, PhotoRec is also capable of recovering videos, documents, archives and other files from various storage media. It’s a free and open source program, working mainly combined with command lines in Terminal.
If the deleted files are just moved to Trash Bin, instead of being permanently removed, you can restore using Mac Terminal, to put the deleted files in Trash folder back to your home folder. Here we will offer step-by-step guides on how to use Terminal on Mac to recover single file, multiple files, and even folders respectively.
Mac Terminal may not work sometimes, especially when the file name of a deleted file contains irregular symbols or hyphens. In this case, if Terminal not working, there are 2 options for how to recover deleted files on Mac from Trash Bin without software.
If you have enabled Time Machine to back up your files on a regular schedule, you can utilize its backup to restore deleted files.
No Time Machine backup available? This is how to recover deleted files on Mac without Time Machine.
In our test, though not all deleted files can be recovered by using Mac Terminal, it does work to put back the files that are moved to Trash to home folder. But due to its limitation to recover files from Trash Bin only, we highly recommend you using Cisdem Data Recovery to recover any deleted files, no matter it is temporarily erased or permanently deleted.
Connie Yu has been a columnist in the field of data recovery since 2011. She studied a lot of data loss situations and tested repeatedly to find a feasible solution tailored for each case. And her solutions are always updated to fix problems from the newest systems, devices and apps.
Donna Byrd
It does work, I followed your steps and recovered batches of files, for a file name with spaces, we need to add \, this is very important and the lesson I learned. Thanks.