If you are wondering how to recover deleted files Mac Terminal, you are not alone. Like any computer, Mac users can also lose data due to many reasons. For instance, you may have moved the files to Trash or used the rm command in Terminal to delete files directly. In this guide, we’ll focus on using Terminal to recover deleted files Mac Terminal and some alternative ways to recover data if it is permanently deleted. You’ll also learn where the deleted data goes and whether there is any professional recovery software to restore permanently deleted files. So, read this guide till the end. 

how to recover files with mac terminal
  1. Part 1: Overview of Mac Terminal
  2. Part 2: How to Recover Deleted Files Using Mac Terminal?
  3. Part 3: Alternative Method to Recover Deleted Files from MacHOT
  4. Part 4: At What Point won't Mac Terminal Help in Recovering Deleted Files?
  5. Part 5: What are the Differences between Deleted and Permanently Delete?
  6. Bonus Tip
  7. Part 6: What are the Common Causes for Data Lost?

Part 1: Overview of Mac Terminal

How Does Mac Terminal Work and What Is It?

Mac is a Unix-based operating system with the Terminal acting as the gateway to its Unix core. Instead of using a mouse to interact with the graphical interface of your computer, the Terminal uses a command line interface for interaction. There are several benefits to using Terminal, such as giving access to hidden settings that cannot be accessed via a graphical interface. In addition, it provides a way to make certain operations execute automatically and more efficiently with a few command lines.

terminal with a few command lines

How to Run Terminal on Mac?

The Terminal app is like any other app on your Mac. So you can run it easily by using any of the options given below:

Option 1: Just open the “Finder” folder, move to “Applications > Utilities,” and double-click on the “Terminal” icon to launch the command interface. 

run terminal on finder

Option 2: Press “Command-Space” to run “Spotlight,” type terminal, and press “Enter” to launch “Terminal.”

run terminal on spotlight

Option 3: Press “F4 “and type terminal to open the “Terminal” app.

run terminal with f4

Part 2: How to Recover Deleted Files Using Mac Terminal?

When you delete files on Mac, they move to the Trash. You can recover deleted files from Terminal Mac by using the below fixes:

Recover Deleted Files from Trash with Mac Terminal

For macOS recover deleted files, Terminal from the Trash proceed with the steps below:

Step 1: Head to “Utilities” and open the “Applications” folder.

head to utilities

Step 2: Launch “Terminal” and type the “open. Trash” command. Press “Enter” to open the “Trash” folder.

Step 3: Once the “Trash” folder opens, you can sort through the files by name, date, and type until you find the ones you want to restore.

find files on trash folder

Step 4: Select the files, and choose “Put Back” by right-clicking on the chosen files. Your files will be restored to their original position.

put back files

Recover Deleted Files with Terminal Command

Here’s how to recover deleted files on Mac using Terminal command. Follow the steps below:

Step 1: Head to “Utilities” and open the “Applications” folder. Select “Terminal,” type the “cd .Trash” command, and press “Return.”

Step 2: Enter “mv xxx ../.” and replace xxx with the deleted file name. Press “Return.” Then enter “Quit” and close the “Terminal.”

enter cd trash command

To find out if your deleted files are restored, open the Finder folder and enter the name of the deleted file in the search bar.

Part 3: Alternative Methods to Recover Deleted Files

You can only use the Terminal to recover deleted files if they are not permanently deleted. But if they are, the above fixes won’t work. However, there is an alternative way to recover emptied Trash Mac Terminal files. If you don’t have a Mac backup and have permanently deleted the files, no method will work to restore your files except data recovery software. We recommend the 4DDiG Mac Data Recovery tool to recover your deleted files with zero hassle and an unprecedented recovery rate. The features of 4DDiG include the following:

  • An intuitive and user-friendly interface.
  • Recover data from Mac-based external and internal drives, SD cards, digital cameras, and USBs.
  • Fast scan and in-depth scan modes.
  • Multiple preview modes to check file details.
  • Modern algorithm to locate hidden and lost files without need to disable SIP.
  • 100% secure and efficient recovery process.
  • Recover files from M1-equipped and T2-secured Macs.

Here are the steps to recover your permanently deleted Mac files with 4DDiG:


For PC

Secure Download



Secure Download

  1. Choose a Storage Drive
  2. Download and install 4DDiG-Mac on your Mac device. Open the tool and choose a drive to scan where you lost your data.

    Select a Location
  3. Scan and Preview Deleted Files
  4. Hover your mouse over the selected drive, and a “Scan” icon will appear. Click on it, and your scanning process will start. You can stop or pause mid-scan to preview the details of your deleted files.

    scanning local disk
  5. Restore and Export Recovered Files
  6. Once the scan finishes, press the “Restore” button and export the files to a location other than where you lost them. This is to avoid permanent data loss.

    preview and recover files

Part 4: At What Point won't Mac Terminal Help in Recovering Deleted Files?

The Terminal recover deleted files still residing in your Mac’s Trash folder. If you have emptied the Trash folder, it means the files are permanently deleted. In such a case, you cannot use Terminal. You’ll have to recover permanently deleted files Mac Terminal, by using a third-party tool like Tenorshare 4DDiG Mac Data Recovery software.

Part 5: What are the Differences between Deleted and Permanently Deleted Files?

When you delete files, they move to the Trash folder on your system. So you can easily recover them. But if you empty your Trash or skip the Trash and delete the files directly, they are permanently deleted. You cannot simply recover them simply from the Trash. However, permanently deleted files still reside in your drive. You just lose access to them. These files are recoverable as long as you don’t overwrite them.

Bonus Tip

How to Increase the Success Rate of Recovering Deleted Files on Mac?

Prior to the data recovery process, if you consider some things, it will increase the success rate of recovering deleted files on Mac. Here are the steps to take:

Backup Regularly: Make a habit of backing up your Mac data regularly. So, in case your Mac files get deleted, you can recover them from the backup. You can either back up your data on Time Machine, an external device, or cloud storage.

Install Reliable Anti-Virus Software: Virus, and malware attacks can cause data loss. It’s recommended to install a reliable anti-virus tool on your Mac and scan your system regularly. Furthermore, don’t download any program or file from non-verified sources, as they may include spammy links.

Avoid Using the Device: If you suspect data loss on a drive, stop using that drive at once. Safely eject any external drive you are using, avoid unnecessary data transfer and turn off the system. Otherwise, if you continue using the drive, it will result in overwritten data which will cause permanent loss. 

How to Protect your Data?

Now, you must have concluded that there are only a few methods to recover data from permanent loss. So what can you do to protect your data from potential loss in the future?

Sync Your Mac with Cloud Software: Syncing your external Mac drive with cloud software will give you many advantages. You can access your files at any time and also share them conveniently. Moreover, if you’ve emptied the Trash or lost your data permanently, you can recover your files from the cloud.

Backup Your Mac On Time Machine: Time Machine provides a free and easy solution to back up your data automatically.  It backs up your Mac’s settings, applications, and files on an external device every hour for the last 24 hours.

Part 6: What are the Common Causes for Data Loss?

There are several reasons behind data loss. Identifying them will help you from potential loss in the future.

Deleting by Accident: Accidental file deletion is a common mistake that can happen when you unintentionally delete files with similar names. Or when you do mass deletion to free up your storage space.

Corrupted Files: Interruptions during file transfer, power outages, incomplete downloads, failed updates, or improper disk ejection can corrupt the file system. As a result, you’ll either lose the files or be unable to access them.

Virus and Malware Attacks: Downloading from non-verified sources or accessing non-trustworthy websites can cause a cyber attack. Usually, malicious links are hidden on non-reliable platforms or downloads that can steal, overwrite or cause data loss. 


Losing data is a common occurrence with any Windows or Mac user. But if you know how to use Terminal, it provides an efficient way to recover deleted files Mac Terminal. Use any of the above methods to recover deleted folder Mac Terminal. However, if you don’t have a Time Machine backup and your data is permanently lost, don’t lose hope. You can still recover your Mac files. We highly recommend using the 4DDiG Mac Data Recovery to restore your permanently deleted files with a 100% recovery rate. It is super easy to use and can restore 1000+ file formats in three convenient steps.

4DDiG - Mac/Windows Data Recovery

Tenorshare 4DDiG Mac Data Recovery

Tenorshare 4DDiG Mac data recovery is a professional Mac recovery software that can recover data from Mac hard drives after emptying the trash, updating the OS, formatting the disk, etc. Over 1000+ formats are supported for Mac data recovery.

(Click to rate this post)

You rated 4.5 ( participated)