> How to > Mac File Recovery > Recover Files Deleted by Command Line on Mac

Recover Files Deleted by Command Line on Mac

Updated on Dec 14, 2017 by Jean to Mac File Recovery

Summary

Use rm/srm command to delete files on Mac? EaseUS Data Recovery Wizard for Mac is able to fully recover files deleted by command lines on Mac. And more mac deleted files recovery solutions are provided in this page.

Deleted files on Mac by using rm command. How to recover?

I accidentally deleted a file by running "rm -rf ./Desktop/myScript.sh". It's not about moving an unwanted file to trash right? Because the deleted file can't be restored from the trash bin. I think there might be some other ways to recover files deleted by command line on Mac OS X since rm command only removes files temporarily. But how? What's your suggestion? I am glad to hear any answer that is helpful.

Command lines used to delete Mac files

  • rm command

rm command simply deletes the directory entry for the file while leaving the disk blocks it used, untouched. You can try to re-discover those blocks contents with some advanced methods.

  • srm command

srm command is a secure remove command on Mac OS X, which overwrites a file and making it unrecoverable.

Solution 1. Retrieve deleted files from Time Machine backup

We highly recommend Mac users have a regular backup of critical system data and important files like photos, documents, music, movies, emails, etc by starting Time Machine. With the automatic backup, Mac deleted file recovery from the command line will be easily settled. Just connect the Time Machine drive with Mac - find your backups - preview the file - restore the file.

Disadvantages:

1. Only users with backups can apply to this solution;

2. Users can only recover the files that were created at the point when they did the backup, not for the case of a newer version recovery.

Solution 2. Recover command line deleted files with recovery tool

It's an all-in-one solution to recover deleted files for Mac by using powerful recovery tool. You can just skip the solution 1 if had no backups at all, and perform Mac data recovery instantly. EaseUS Data Recovery Wizard for Mac is what you need, with which Mac data recovery won't bother you any more. It can help not only recover files deleted by command line, but also restore files lost by Mac drive formatting, virus infection, system reinstallation and more. Follow the 3-step guide below to recover files deleted by command line on Mac.

Step 1. Select the location where your important data & files were deleted and click Scan button.

select the location where data was deleted and click scan

Step 2. The software will run both quick scan and deep scan and work hard to find as many deleted files as possible on the selected volume.

scan the selected disk to find deleted files on your Mac

Step 3. The scan results will be displayed in the left pane. Just select the file(s) and click Recover Now button to get them back.

click recover now button to recover deleted files on your Mac