Accidental data loss is a common occurrence during everyday computer use. It's not uncommon to delete a needed file on your Mac. When this happens, you'll want to know how to recover the lost file.

With this guide, you'll learn how to recover deleted files on your Mac using two of the most effective methods:

Recover deleted files on Mac

How to Delete a File on a Mac

Here, we have enlisted some common ways to delete files on Mac and gathered two methods to help you recover files from different situations of file loss on Mac.

Know the reasons for file loss and choose the right way to recover deleted files now from your Mac:

# How to Permanently Delete Files on a Mac
Method 1: Using Terminal Method 2: Using Mac File Recovery Software
  • Drag the file to the Trash
  • Right-click the file and move it to the Trash
  • Drag the file to the Trash
  • Right-click the file and move it to the Trash
  • Empty the Trash
  • Use the Option + Shift + Command + Delete keyboard shortcut
  • Use the RM command in Terminal
  • Use the RM -R command in Terminal
  • Use the RM -f command in Terminal
### Method 1: Using Terminal 1. **Open Terminal**: Type "Terminal" into Spotlight search, then click the result to open it. 2. **Navigate to the file location**: Use the `cd` command to navigate to the directory containing the file you want to delete. For example, if your file is on the desktop, type `cd ~/Desktop`. 3. **Use the `rm` command**: Type `rm [filename]`, replacing `[filename]` with the name of your file, then press Enter. This will delete the file. ### Method 2: Using Mac File Recovery Software 1. **Download and install file recovery software**: Choose a reputable file recovery tool, such as Stellar Data Recovery. 2. **Launch the software**: Run the software and select the drive or specific folder to scan. 3. **Scan for files**: Initiate a thorough scan to find deleted files. 4. **Preview and select files**: After the scan, preview the found files and choose the ones you want to permanently delete. 5. **Permanently delete**: Follow the software's instructions to select the deletion option to permanently remove the selected files.

Note that Terminal can't help you recover files that you permanently deleted by emptying the Trash on your Mac or using the rm command in Terminal.

This code translates to: ```javascript $(document).ready(function() { $('.click_copy_box .click_button').on('click', function() { var self = $(this); // Store the clicked element var Url2 = $(this).parent().find('textarea'); // Find the textarea in the parent element Url2.val(Url2.val()); // Set textarea value Url2.select(); // Select the text document.execCommand("Copy"); // Execute the copy command $(this).html('Copied'); // Change button text to "Copied" setTimeout(function() { // Delay for 3 seconds self.html('Click to copy'); // Reset button text to "Click to copy" Url2.blur(); // Remove focus from textarea }, 3000); }); }) ``` This script is a jQuery function that handles copying the text inside a textarea when a button is clicked. Upon clicking the button, the text is selected and copied to the clipboard. The button's text temporarily changes to "Copied" for 3 seconds before reverting back to "Click to copy", and the textarea loses focus.

 What are 'rm', '-r', and '-f' in the terminal?
rm: Means permanently deleting a file.
-R: Means deleting a folder along with its contents.
-f: Means force deletion without prompting for confirmation.

It's high time you picked the right method and followed a specific tutorial to instantly undelete a file or reverse the RM command from the Mac Terminal.

Method 1: Recovering Deleted Mac Files Using Terminal How to Recover Deleted Files on a Mac Using Terminal

Applies to: Restoring deleted files on Mac by dragging and dropping or right-clicking and moving them to the Trash.

This is a regular method that Mac users sometimes use to delete or recover files through the Terminal. Not only can you delete files on your Mac as shown above, but you can also use the command line to recover deleted files from the Mac Terminal.

Follow these steps to recover deleted files on your Mac using the Terminal with the following UTF-8 encoding:

(This was on a MacBook Pro running macOS Mojave 10.14.2.)

Step 1: Go to Finder > Applications > Utilities, and then double-click Terminal.

How to recover deleted files on Mac using Terminal

Step 2: Type cd.Trash, and then hit "Enter."

Step 3: Type ls and press Return.

Step 4: Type mv yourfilename ../ and press "Enter." (Make sure to use your file's full name in the command.)

5. Type Quit, and then close the terminal window.

Step 6: Open Finder and type the name of your lost file in the search bar in the top right corner.

TIP
cd.Trash is used to locate the Trash.
ls is used to display the names of files and subdirectories in the folder.
mv yourfilename ../ moves the file back to its original directory.

Here you will see your recently recovered file. You can move it to any location of your choice.

## Method 2: Recover Deleted Files with a Mac Data Recovery Software

Applies to: recovering files from the Trash, using Option+Shift+Command+Delete to delete files, and using the rm, rm -R, or rm -f command to delete files.

As mentioned in Method 1, terminal commands work only when you want to recover deleted files from Mac trash. If you have emptied the Trash, used Option+Shift+Command+Delete keys or executed rm, rm -R, rm -f command, then chances are that your Mac file is not recoverable.

Another option you can try is to let a reliable Mac data recovery software help you out. If you've deleted files from Mac Terminal following the above three steps, the data recovery wizard can assist you.

< strong > Steps to Recover Deleted Files from Mac (Reverse RM -R -F):

Note: You can first click on "Disk Backup" on the left to create a backup. The software will recover the deleted files from the backup image. This prevents further damage to your disk and data, making it safer and more reliable.

Step 1: Scan the deleted files

Select the hard drive, external drive, or SSD that contains the important data and files you want to recover, then click Search for lost files.

Select the location on your Mac and scan for deleted files

Step 2: Filter for missing files

The software will scan the selected volume quickly and thoroughly, trying to find as many deleted files as possible. Filter the required files by Type and Path options.

Select and scan for lost files

< strong > Step 3: Recover the deleted file

Double-click to preview the deleted files, and then click the “Recover” button to get them back.

Recover Deleted Files from Mac

After you recover files from a Mac, remember to save them to an external drive. Once you're sure the device can save files again, you can move the recovered files back to your Mac.

What else can the Mac Data Recovery Wizard do:

1. Recover Files from Mac That Terminal Command Line Can't Handle:

2. Search for various types of files, including:

Mac Data Recovery Wizard recovers files like photos, documents, videos, audio, email and more from your Mac.

3. Recover data from all types of storage devices:

Mac Data Recovery software recovers data from Mac (PC), hard drive, USB drive, SD card, memory card, digital camera and other devices.

Please take a moment now to recover your files by following the steps below.

On this page, we demonstrate how to delete files properly on a Mac. Based on feedback from most Mac users, we have also gathered two reliable and practical methods to help you safely recover lost files from your Mac.

    • For files sent to the Mac Trash, you can recover them all directly by following the steps in Method 1 using Terminal.
    • For files and folders permanently deleted or erased by Terminal commands like RM, -R, and -F, Method 2 with a Mac data recovery app is always at your service.

Now it's your turn. Take it slow, and follow this guide to put the files back on your Mac.