How to Recover Deleted Files from Mac Terminal [2 Ways] - Qiling  

How to Recover Deleted Files from Mac Terminal in 2 Ways


Accidental data loss is a common issue on Macs, often resulting from accidental file deletion. When this happens, users may feel frustrated and wonder how to recover their lost files. This can be a stressful situation, especially if the deleted files were important. Fortunately, there are ways to retrieve lost files on a Mac, and understanding these methods can help prevent data loss in the future.

If you've accidentally deleted a file on your Mac, don't worry! You can recover it using two efficient methods.

recover deleted files mac

PAGE CONTENT:
How Did You Delete Files, Pick aWay to Recover Deleted Files
Way 1.How to Recover Deleted Files on Mac UsingTerminal
Way 2.How to Retrieve Deleted FilesUsing MacData Recovery Software

How Did You Delete Files on Mac

Here are some normal ways of deleting files on Mac and two ways to help you retrieve files on Mac from different file loss situations. Mac users can delete files using the Finder, Trash, or Command + Delete keys, but sometimes these deleted files can be recovered using software like Disk Drill or Deep Data Recovery Wizard, which can scan the Mac's hard drive and recover deleted files, even if they have been emptied from the Trash.

To recover deleted files from your Mac, identify the cause of file loss, such as accidental deletion, formatting, or virus attack. Then, choose the appropriate recovery method based on the file loss reason.

#1. Use Terminal #2. Use Qiling Mac File Recovery Software
  • Drag files to Trash
  • Right-click to move files to Trash
  • Drag files to Trash
  • Right-click to move files to Trash
  • Empty Trash
  • Use Option + Shift + Command + Delete keys
  • Use RM command in Terminal
  • Use RM - R commandin Terminal
  • Use RM - f commandin Terminal

Terminal can't help you restore deleted files that are permanently deleted due to emptying Mac trash or using Terminal rm commands.

What is rm, -r, -f in Terminal?
rm:It means to permanently delete a file.
-R:It means todelete a folder and its content.
-f:It means force removal without confirmation.

To recover from deleting a file or running the "rm" command in the Mac Terminal, follow the specific tutorial to undo file deletion. Now, it's your turn to pick the right way and take action.

Way 1.How to Recover Deleted Files on Mac UsingTerminal

Applies to:To restore deleted files on a Mac, you can simply drag them back to their original location from the Trash, or right-click (or control-click) on the file in the Trash and select "Put Back" from the context menu. This will restore the file to its original location, effectively undoing the deletion.

Mac users often use Terminal to delete or recover files, offering a command-line alternative to the usual delete and undelete methods.

To recover deleted files on a Mac using Terminal, follow these steps. First, open Terminal and navigate to the folder where the deleted file was located.

This example was performed on a MacBook Pro running macOS Mojave 10.14.2.

Step 1.Go to "Finder" > "Applications" > "Utilities" and double-click "Terminal".

How to Recover Deleted Files on Mac using Terminal

Step 2.Type cd.Trash and hit "Return".

Step 3.Type lsand hit "Retrun".

Step 4.To move a file to the parent directory, type `mv yourfilename ..` and press return. (Replace "yourfilename" with the actual name of your file.)

Step 5.Type Quit andexit the Terminal window.

Step 6. Go to Finder, enter the name of your lost file in the search bar at the top-right corner.

Tip
cd.Trashmeans to locate Trash.
lsTo display the name of files and subdirectories in the directory means to list the contents of the current directory, showing the names of all files and subdirectories within it.
mv yourfilename ../means to move thefile to its originaldirectory.

After recovering the deleted file, you can see it in the results. You can then move it to any desired location on your device.

Way 2.How to Retrieve Deleted FilesUsing MacData Recovery Software

Applies to:Retrieve files from Trash, Option+Shift+Command+Delete, rm,rm -R,rm -f command.

To recover deleted files on Mac, use the Terminal command `cd ~/Trash && ls -al` to list deleted files, then `cd ~/Trash && ls -al | grep "yourfilename"` to search for a specific file, and finally `cd ~/Trash && cp -r "yourfilename" ~/` to recover the file. However, this method only works if the file was deleted from the Trash, and not if it was deleted using Option+Shift+Command+Delete keys or running `rm`, `rm -R`, or `rm -f` command. In such cases, other methods like data recovery software or professional help may be needed to recover the file.

You can try to recover deleted files from Mac Terminal by using the "ls" and "rm" commands to locate and restore the files, or by using reliable Mac data recovery software like Deep Data Recovery to help with the process.

Steps to Retrieve Files Deleted from Mac (Undo RM -R -F):

Step 1. Launch Deep Data Recovery for Mac, select the desired file types, and click "Next" to initiate the recovery process.

Select file types that you want to recover

Step 2. To recover deleted files, select the location where the files were deleted and click the "Scan" button. This will initiate a scan of the selected location to locate and recover the deleted files.

select the location where data was deleted and click scan

Step 3. The software will perform both a quick scan and a deep scan on the selected volume, working diligently to identify and locate 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. Select the desired file(s) and click the "Recover" button to retrieve them.

After restoring files from your Mac, save the recovered files to an external hard drive, then move them back to your Mac once it's available to save files again.

What Else Can Qiling Mac Deep Data Recovery Do:

1. Recover files from Mac that Terminal command line can't do:

2. Retrieve multiple types of files, including:

Qiling Mac Deep Data Recovery allows for the recovery of various file types, including photos, documents, videos, audio, emails, and more, from a Mac device.

3. Restore data from all types of storage devices:

Qiling Mac data recovery software can recover data from various devices such as Mac, PC, hard drive, USB drive, SD card, Memory card, and digital camera.

Take Time, Follow to Bring Your FilesBack onMac Now

On this page, we showed you the normal ways to delete files on Mac, but we also collected feedback from users who found themselves in need of recovering lost files. Two reliable and practical ways to bring back deleted files on your Mac have been shared.

To recover lost files on your Mac, take your time and follow these steps. First, check if the files are in the Trash or a different folder. If you've recently deleted them, they might still be there.

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