How to Recover Files on Mac Deleted with Command Line

Updated to macOS Data Recovery Tips by Robert on Apr 26, 2023 | Approved by Christian Cawley

"How can I recover permanently deleted files from CMD? Some people told me I can try it since it works in Windows PC and it must be workable on Mac."

The command line, also known as text interface, or command screen, is a user interface that you can use to view and manage your computer files by entering commands. Using the command line, you can delete files/folders that can’t be deleted by the DEL option. There are situations you might end up deleting important files by mistake. In such scenarios, the files deleted by the command line will bypass the trash folder and thus, making no possibility of recovering them from the trash folder. No worries!! We have good news for you. In other words, there are methods out there to help you recover deleted files by Mac command line with ease. Continue reading to learn how to get back your files on Mac deleted with the command line.

Part 1: Recover Command Line Deleted Files on Mac Directly

If you want an easy, quick and powerful solution to recover command line deleted files in Mac, look no further from iBeesoft Data Recovery for Mac. The software requires no technical knowledge and skill to get back files deleted by the command line on Mac. The files lost by accidental deletion still present on the logical memory of your system volume. With this file recovery Mac tool, you can recover them in no time and a few clicks of a button.

Your Effective Mac Data Recovery Software

(Trust Score 4.7 by 1695 Users)
  • Two powerful scanning modes - quick and deep to locate lost Mac files.
  • Supports to recover deleted photos, videos, documents or other more than 800 file types on Mac.
  • Let you preview the recoverable data and able to perform Mac file data recovery from a wide range of storage devices including memory cards, USB drives, pen drives, removable disks, etc.
  • Powerful enough to work in every data loss scenario on Mac including accidental deletion, emptied trash, command line deleted files, virus attack, formatted drives, sudden power failure, and a lot more.
Free Download

Here’s a quick guide to recover files deleted by Command Line with iBeesoft Data Recovery. Get it from the official website and follow the below steps to get started with Mac OS X recover deleted files command line:

Step 1: Select file types

Run the software on your computer. From the main interface, select the target file types you would like to get back from your system and click on the "Start" button to recover deleted files on Mac.

Step 2: Select the location to scan

The next step is to select the location from where you lost your data. After selecting the target location, click on the "Scan" button to look for your lost files on Mac.

Step 3: Preview & recover command line deleted files on Mac

Once the scan process completes, the software lets you preview the recoverable files. Finally, select the target files you would like to recover and click on the "Recover" button to get them back on your Mac.

As you now see that recovering lost or deleted files from Mac is no more hassle if you rely on iBeesoft Data Recovery for Mac. Needless to say, don’t save your recoverable data to the same location from where you have lost in the first place. You should use another safe location.

Part 2: Recover Command Line Deleted Files with Terminal Command

For the users who don’t want to use any third-party software, recovering command line deleted files using terminal command is recommended. Moreover, if you’re good at command lines, then you should give a try at least once.

Here’s how to recover command line deleted files on Mac with Terminal command:

Step 1: Navigate to "Applications" > "Utilities" > "Double-tap on Terminal" to run the application.

Step 2: Type the command "cd.Trash" and hit the "Return". Then, type "mv xxx ../". And replace the "xxx" with the name of the deleted files. Press the "Return".

Step 3: Type "Quit" in the command line window.

Step 4: Go to the "Finder" window and enter the full name of your deleted files in the search field at the top right section of the window to locate the restored files.

Not to mention, you must enter the Terminal command exactly as mentioned. Otherwise, you won’t be able to recover your command line deleted files. The above steps are applied to even for those wondering - how can I recover permanently deleted files from CMD.

Part 3: Recover Command Line Deleted Files By Restoring from Time Machine Backup

Time Machine is an in-built backup feature available on Mac. It automatically backs up all of the Mac files, which include music, photos, documents, apps, email and system files. Once you realized that you have deleted important files and they are no longer in the Trash bin, simply restore it from your Time Machine backup. This is an easy operation in which all you need to do is to attach the external device that you have been using to keep your Time Machine backups.

Here’s how to recover command line deleted files by restoring from Time Machine backup:

Step 1: Connect the device containing the Time Machine backup. Then run the Time Machine.

Step 2: Go to Finder in the location that you last remember viewing the file. Continue scrolling through Time Machine until the desired file appears in the Finder window.

Step 3: Select the target files and click on "Restore" to get the command line deleted files back on Mac.

That’s all on what to do to recover deleted files Mac command line. Considering all the things discussed here, it is fair to say that iBeesoft Data Recovery for Mac is the best solution available out there. It helps to do the job within a few minutes and without any hassle. Whenever you lost data on Mac due to accidental deletion, virus attack or system failure, the software can help you rescue your files like a pro. Try it now to get back your Mac files deleted by the command line.