Recover Deleted Files Mac Terminal and Better Alternatives for Recovery

When you delete files from Mac by Terminal or other features, are you afraid that those significant files and documents will be accidentally or mistakenly erased during deleting? EaseUS Data Recovery for Mac will recover your lost Mac data easily.

Table of Contents

Workable Solutions Step-by-step Troubleshooting
1. Can You Recover Files On Mac Yes, you can recover deleted files on your Mac. But how you do it depends on the...Full steps
2. Recover Mac Files by Terminal Go to Finder > Applications > Utilities > Locate Terminal and double-click > Type the...Full steps
3. Alternative Ways to Recover Files

Fix 1. Try Time Machine...Full steps

Fix 2. EaseUS Data Recovery Wizard for Mac...Full steps

4. How to Secure Mac Data Unfortunately, not all file recovery attempts are successful. Sometimes, the recovery fails...Full steps

Nothing scares people like accidentally deleting your files on Mac. And when you realize that you have no idea of recovering emptied Trash on Mac, you can become hopeless. Don't despair. You can still recover deleted files on Mac even if you've emptied the bin. The best method to recover deleted files on Mac is through the Terminal.

recover deleted mac files from terminal

However, there are other alternatives, like restoring data from Time Machine or third-party software. Therefore, in this article, we'll guide you on how to recover deleted files using a Mac terminal and other alternatives. 

Can You Recover Deleted Files On Mac

Yes, you can recover deleted files on your Mac. But how you do it depends on the extent you've gone with the deletion. Hitting the "Delete" button doesn't really delete files but sends them to the trash. To get rid of these files forever, you must manually empty the Mac trash.

So, if you deleted your files accidentally but haven't emptied the trash, you can go to the trash and recover them. Alternatively, if you hit the delete button accidentally, you can use the "Undo" option to recover the files. But this method requires you to do it immediately when you delete the files. Otherwise, they'll go to the trash, where you can still recover them. The tool will find the file's entry and retrieve it.

But if you've also emptied the trash or bypassed the trash to delete the files permanently, you will have to resort to other methods to recover deleted files. These other methods include recovering deleted files from the Mac terminal app, using the Time Machine, or using an efficient Mac data recovery tool

related articles

Mac Trash Recovery | Restore Trash Data on Mac

It is quite easy for users to delete files into the trash on Mac and most Mac users would clean up their trash bin regularly.

recover data step 1

Recover Deleted Mac Files Using Terminal

You can recover deleted files using the Mac Terminal's special text commands. If you want to recover permanently deleted files on Mac without using a third-party tool, the Mac Terminal is your excellent choice. But you can only use the Terminal command to recover deleted files from Mac Trash.

To recover deleted files on Mac Terminal, follow the steps below:

Step 1. Go to Finder > Applications > Utilities.

mac applications utilities terminal

Step 2. Locate Terminal and double-click > Type the command: cd.Trash > then press the "Return" key to navigate to the trash folder.

mac trash folder

Step 3. Type the command: ls -al ~/.Trash > and press Return to view the content of the Trash folder.

Step 4. Type mv xxx../ > and hit Return to move the recovered file to your home folder (replace xxx with the name of the file you're trying to recover).

Step 5. Type Quit in the Terminal. This will exit Mac from the Terminal window. 

  type quit in the terminal

Go to the file's location and try to open it to see if it's been recovered. 

Alternative Method to Recover Deleted Mac Files

If the trash has been emptied, and you can't use the Terminal to recover deleted Mac files, turn to other methods to recover deleted files on Mac. For example, users can also recover deleted files using Time Machine or a third-party tool.

Solution 1. Try Time Machine

If you've failed to recover lost files from your Mac. If you have a trash folder and wish to recover Mac data without software, the Time Machine is your easiest option.

Time Machine is Apple's built-in backup solution for the Mac in macOS High Sierra and macOS Catalina. If your Mac's Time Machine backup was enabled before the files were deleted, then you can recover deleted data on Mac through the recently backed up files even if you've emptied the trash bin.

restore data from time machine

But if your Time Machine wasn't enabled before the files were deleted, this recovery option won't be available to you. In that case, you can try other methods.

To recover deleted files on Mac Time Machine, follow these steps:

Step 1. Launch the Time Machine app on your Mac.

launch time machine app

Step 2. In the Time Machine app, search to find the specific files you want to restore using the onscreen up and down arrows to locate it. Then you can preview it by pressing Space Bar.

Step 3. To restore the deleted files, click "Restore" button.  

 time machine restore button

Solution 2. Use EaseUS Data Recovery Wizard for Mac

You can also conduct data recovery for Mac using specialized data recovery software. One such software is the EaseUS Data Recovery Wizard for Mac. It is a professional data recovery software with special features for Mac to recover data lost from accidental deletion, emptied Trash Bin, or other causes.

With the EaseUS Data Recovery tool, you can recover data such as document files, photos, music, videos, emails, and more. You can recover data from any Mac-based device such as SSD, HDD, fusion drive, Time Machine backup drive, etc.

The tool has high-capability features, including data scan, file filter, file preview, data protection, and remote IT support. The best part is that you don't need any technical knowledge to operate it.

How to recover deleted files on Mac using the EaseUS Data Recovery Wizard for Mac:

Step 1. Select the drive to be scanned

In the main EaseUS Data Recovery Wizard window, there will be a list of the drives connected to your Mac. Select the drive you need to recover lost/deleted files from, and click the "Search for lost files" button.

Note: Before data recovery, you'd better click "Disk Backup" from the left sidebar to create a backup of your Mac to avoid further data loss. After backing up, the software can recover data from the Mac backup, and your computer can wirte new data again.

select a location and scan for lost Mac data

Step 2. Select your lost data/files

EaseUS Data Recovery Wizard for Mac will immediately scan your selected disk volume and display the scanning results on the left pane. You can sort the results to find the wanted files if you are looking for certain files.

Select your lost data/files

Step 3. Recover lost/deleted data

Once you have found the desired files, preview the files and then click "Recover" to begin the recovery of your deleted/lost Mac files.

recover lost Mac data

A Practical Guide to Secure Your Mac Data

Unfortunately, not all Mac file recovery attempts are successful. Sometimes, the recovery fails because the deleted files have become overwritten. Other failed attempts to recover data may rise because of user error, data corruption, or physical damage. This is why it's important to avoid situations where you have to try and recover your data after accidental deletion or other damage. 

Here are some tips to keep your Mac's data secure and intact:

Backing up data regularly: Use Mac's Time Machine to back up your data. Alternatively, you can use other cloud storage applications to back up your data physically on a different hard drive.

Enabling the built-in firewal: MacOS has a built-in, easy-to-use firewall. Enabling the firewall can help prevent potentially harmful incoming connections that can erase your data.

Install antivirus software: Installing an AV tool will routinely scan your Mac for malware and bad actors and arrest them before they cause further damage to your data.

Disable macOS remote access: With remote access, you can access your files from anywhere, but it's also risky because anyone with an admin login can also access your files. 

Use a password manager: A password manager will help you have strong passwords with the right length and characteristics and keep the passwords safe, so you don't have to write them down. This is a fundamental aspect of password usage and Mac access. 

Conclusion

If you mistakenly delete a file on Mac, don't panic because you can recover them from the trash bin using the Terminal command. If you've emptied the trash, it's still possible to recover deleted files on Mac from the Time Machine or use data recovery software. But it is important always to protect your data to avoid situations where you have to recover the data.

Was This Page Helpful?

Updated by Cedric

Cedric Grantham is a senior editor and data recovery specialist of EaseUS. He mainly writes articles and how-to tips about data recovery on PC and Mac. He has handled 10,000+ data recovery cases and is good at data recovery of NTFS, FAT (FAT32 and ExFAT) file systems, and RAID structure reorganization.

Read full bio

Written by Jean

Jean is recognized as one of the most professional writers in EaseUS. She has kept improving her writing skills over the past 10 years and helped millions of her readers solve their tech problems on PC, Mac, and iOS devices.

Read full bio

Product Reviews

TrustScore 4.7 | 59 reviews
  • EaseUS Data Recovery Wizard is a powerful system recovery software, designed to enable you to recover files you’ve deleted accidentally, potentially lost to malware or an entire hard drive partition.

    Read More
  • EaseUS Data Recovery Wizard is the best we have seen. It's far from perfect, partly because today's advanced disk technology makes data-recovery more difficult than it was with the simpler technology of the past.

    Read More
  • EaseUS Data Recovery Wizard Pro has a reputation as one of the best data recovery software programs on the market. It comes with a selection of advanced features, including partition recovery, formatted drive restoration, and corrupted file repair.

    Read More