[With Bonus Tips] How to Recover Deleted Files with Mac Terminal - Qiling  

How to Recover Deleted Files with Mac Terminal & Alternative Ways


Workable Solutions Step-by-step Troubleshooting
Fix 1. Undelete with Terminal Command Go to "Applications" > "Utilities" > double-click on "Terminal" to open the application > type cd .Trash...Full steps
Fix 2. Restore with Backup on Mac Connect the Time Machine backup disk to your Mac and turn it on > find files and select...Full steps
Fix 3. Restore files with software Download Qiling file recovery software for Mac > select the location > scan...Full steps

Mac Delete Situations: How to Understand "Delete" on Mac

On a Mac, you can delete a file by moving it to the Trash, which is located on the Dock. You can also delete a file by pressing the Command key + Delete key, or by selecting the file and pressing the Delete key. Additionally, you can erase a USB drive to wipe out all data by using the Disk Utility app. It's worth noting that deleting a file from the Trash or erasing a USB drive will permanently remove the data, so be sure to backup any important files before doing so.

To delete files on a Mac, you can simply drag and drop them into the Trash, or use the shortcut "Option+Command+Delete" to quickly remove a file. Alternatively, you can use the rm command to delete files, which is a more technical method that may be unfamiliar to most Mac users.

What is the rm command?
By running "rm -You can delete multiple unwanted files at once on a Mac by using the "rm" command in Terminal, followed by the filenames you want to delete, separated by spaces. For example, if you want to delete files named "file1.txt", "file2.txt", and "file3.

A Brief Overview of rm Command Line 

The rm command deletes a file by removing its directory entry, leaving the disk blocks used by the file untouched. This means the file's contents are still on the disk, but the operating system can no longer access it, making it unrecoverable. The only way to recover the file is through advanced methods that can re-identify the disk blocks and their contents. However, the blocks themselves are not reused, making recovery extremely difficult.

How to Recover Files Deleted on Mac - with Terminal, Time Machine, Software

If you've accidentally deleted files using the rm command on Mac, they won't go to the trash bin, making it impossible to recover them from there. However, you can still use advanced methods to recover deleted files using the command line.

Method 1. Undelete Files with Terminal Command on Mac 

1. Go to "Applications" > "Utilities" > double-click on "Terminal" to open the application.

2. Type in the following Terminal command: cd .Trash, then hit the "Return".

3. To restore a deleted file, type mv xxx ../, replacing "xxx" with the full name of the file you deleted, and then press the "Return" key. This command moves the file from the current directory back up to the parent directory, effectively restoring it. 

4. Type Quit in the Terminal window.

5. To recover deleted files, launch the "Finder" window and search for the deleted files by entering their name in the search bar at the top right part of the window. This will help you find the restored files.

To recover data from a corrupted or deleted file, you must type the Terminal commands exactly as they are written. If you make any mistakes, the data recovery process will fail.

Method 2. Restore with Time Machine Backup on Mac

Important
If you have a backup, you can apply to this solution. However, if you haven't made any backup before, jump to the next part to recover deleted Mac files with the user-friendly Deep Data Recovery for Mac.

Time Machine, the built-The backup feature of your Mac automatically backs up all of your files, including apps, music, photos, email, documents, and system files. This ensures that you can easily recover deleted files from the command line with a backup in place.

1. Connect the Time Machine backup disk to your Mac and turn it on.

2. Find the files you want to restore in your Time Machine backup. To confirm your selection, press the Space Bar. This will allow you to preview the item and ensure it's the correct one before proceeding.

3. Click "Restore" to recover the items you selected.

Method 3. Restore Mac Deleted Files with a Data Recovery Tool Without Backup

If you're not familiar with the command line or don't have a Time machine backup, a Mac data recovery program is your best option. Deep Data Recovery for Mac can help recover files deleted by the command line, as well as restore lost files from a formatted hard drive or partition, virus infection, system reinstallation, and more, making it a convenient and effective solution.

Step 1. Launch Qiling file recovery software on your Windows computer. Select the file types you want to recover and click "Next" to proceed with the recovery process.

Select file types that you want to recover

Step 2. Please select the location where your important data and files were deleted, and then click the "Scan" button.

select the location where data was deleted and click scan

Step 3. The software will perform a quick scan and deep scan on the selected volume, working diligently to recover as many deleted files as possible.

click recover now button to recover deleted files

Step 4. The scan results will be displayed in the left pane. To recover the file(s), simply select them and click the "Recover" button.

Related Articles


Is this information helpful?     

What can we do to improve this information? (Optional)
Refresh Please enter the verification code!


QilingTech uses cookies to ensure you get the best experience on our website.  Learn more  Got it