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. In the latter part of this post, we offer solutions when Terminal not working in some cases, like restoring files deleted with Terminal rm command.
Terminal is the macOS command line application, with a collection of command shortcuts, you can perform different tasks on your Mac quickly and efficiently without repeating certain actions manually.
You can utilize Mac Terminal to open 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 the file to Terminal and press Enter key to delete the file. But you won’t be able to retrieve this deleted file in your Mac 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, Terminal cannot recover a permanently deleted file.
It can delete a file permanently, but speaking of Terminal recovery, it only applies to recovering files moved to Mac Trash bin, and you cannot recover deleted files using Mac Terminal in following cases:
But luckily, we have ways to recover permanently deleted files that erased by Terminal rm command, in part 4, you will find the solution with steps.
If the deleted files are just moved to your Trash bin, instead of being permanently deleted, you can restore using Mac Terminal, to put the deleted files or folders in Trash folder back to your home folder. Here we will offer the step-by-step guide to recover one or multiple files, even folders using Terminal command line.
As we mentioned at the beginning of this post, Terminal only works on recovering deleted files in Trash bin, it doesn’t work when a file is permanently deleted, no matter it is deleted by "deleted immediately" "Command+Option+Backspace" "Empty Trash" or "rm command line in Terminal". But no worries, here we will offer the easiest way to recover files permanently deleted with Terminal rm command line on Mac, that is, using Cisdem Data Recovery for Mac.
Cisdem Data Recovery is a Mac data recovery program to restore deleted, lost and formatted files from both internal and external drives, for example, it can recover files from Mac internal hard drive, external hard disk, USB, SD Card, media players, etc. It can read and recover 200+ types of files, including videos, audios, photos, documents, archives and others.
Cisdem Data Recovery Main Features
Mac Terminal may not work sometimes, especially when the file name of a deleted file contains irregular symbols or hyphens. In this case, there are 2 options to recover deleted files from Trash bin if Terminal not working.
If you have enabled Time Machine to back up your files on a regular schedule, you can utilize its backup to restore deleted files too.
In my test, though not all deleted files can be recovered by using Mac Terminal, it does work to put back the files I moved to Trash to home folder. But due to its limitation to recover files moved to Trash bin only, we highly recommend you using Cisdem Data Recovery to recover any deleted files, no matter it is temporarily deleted, or permanently deleted.
Connie has been writing for Mac productivity and utility apps since 2009. Each review and solution is based on her practical tests, she is aways energetic and trustworthy in this field.
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.