How to Recover A File After RM on Linux, Mac or Windows

avatar
Zoey Wen
October 29, 2024 Preview 35 Preview 0
share it facebook share it Twitter

rm is one of the most efficient commands to remove specified files or directories, across different devices like Linux, macOS, Windows. But when you run this command on you computer by mistake, it can sometimes be tricky to undo and recover the files after rm.

On different devices, the options to recover rm files will be different. This guide will walk you through the steps on how to recover files after rm and ensure the deleted file can be opened without error.

 

Does rm Permanently Delete Files? Where Do Files Deleted with rm Go?

rm is the short term of remove, it deletes files by removing its reference to a file or directory, you can add options like -r, -i, -f, -v, -d. It won’t move the deleted files to recycle bin on your computer, it permanently deletes the files and you won’t be able to restore from trash bin.

It is not in the recycle bin, then where do the files deleted with rm command go? It is still on the drive where it was originally stored, it just becomes invisible, because the system marks this space as available to add new data. If there is new data written, and right into this space on your device, the rm deleted file will be gone forever.

So, Can An RM File Be Recovered?

Yes, but it can be only recovered before it is overwritten by other new data. Therefore, stop adding new data to your computer immediately, operations like updating system, running apps, transferring files, editing files, browsing websites will write a large amount of new data to your device. The more data you add to your device, the less possible you are able to recover the rm deleted files. So, action faster.

 

All-in-one solution to Recover A File after rm on Linux, Mac or Windows

Restoring a file after rm can be a challenge, the solution for different operating systems would vary, this is where Cisdem Data Recovery comes into play.

It is a robust data recovering program, equipping with diverse feature options such as hard drive recovery, SD Card recovery, crashed PC/Mac recovery, Linux recovery and NAS recovery. This app is reliable and efficient to restore 1000+ types of files under various data loss situations: deletion, formatting, corruption, missing, system crash, etc.

Cisdem also provides the ability to repair damaged files like video, photo or office documents, which saves you from the trouble of unable to open a file after recovery. Cisdem Data Recovery focus a lot on recovery rate and speed. It does the scanning and digging thoroughly to find a lost file, assists in discovering files quickly with a filter tool. The Preview feature is prominent, users can check the found files by viewing thumbnails or reading full file with defaulted readers, the preview loads quickly and it will be highly efficient to recover those wanted without error.

Cisdem supports both Windows and macOS, also offers free trial, with the paid plans starting with one-month plan, which is good for those want to recover lost files in a pinch.

How to Recover Files after rm on Linux?

  1. Download and install Cisdem Data Recovery on Windows PC.
    Free Download Windows 11/10/8/7
  2. Go to NAS & Linux, then choose Linux Recovery. recover rm file on linux 01
  3. Enter the user name and password, then click on Connect Now.recover rm file on linux 02
  4. Now, go to Type and check the folders on the left, you will see all the deleted rm files Cisdem has found on the Linux device. recover rm file on linux 03
  5. Preview the files, select and click Recover button to restore. recover rm file on linux 04

 

How to Recover Files after rm on Mac or Windows?

  1. Download and install Cisdem Data Recovery on your Mac or Windows.
    Free Download macOS 10.9 or later Free Download Windows 11/10/8/7
  2. Go to Hardware Disk and select the drive where you deleted the files with rm command, click Search for lost files.recover rm files mac 01
  3. Then go to Type, check your deleted files in the folders listed in the left side. Also, you can use filter or search box to quickly locate a file.recover rm files mac 02
  4. Preview the files, then select and click Recover button.recover rm files mac 03

 

How to Recover rm Files on Linux (Free)?

Linux doesn’t allow undoing rm, which makes the situation a little tricky. If you are looking for a free solution to recover a rm file on Linux, because you are still in doubt with  3rd data recovery apps like Cisdem, there are 2 ways for you.

#1 Use TestDisk

TestDisk is a free data recovery application available on Linux, Windows, macOS and other operating systems. It runs in a shell to recover deleted files, especially lost partitions and unbootable disks. The latest version is 7.2, which was released in Feb 22nd, 2024. If you don’t have a backup of the deleted files, you can follow up the steps:

  1. Open the command tool on your device, then input sudo apt-get install testdisk -y, and press Enter.recover rm files testdisk 01
  2. Enter your password to install testdisk on your Linux.
  3. Input mkdir ~/recovery, press Enter; then input cd ~/recovery, press Enter; finally input sudo testdisk and press Enter to run Testdisk.recover rm files testdisk 02
  4. Create a new log file or just skip this step. Press Enter.
  5. Select the Linux drive where the file is rm deleted, then press Enter.recover rm files testdisk 03
  6. Select the Linux partition table type, press Enter.
  7. Select Advanced and press Enter.recover rm files testdisk 04
  8. Select the Linux partition where you deleted the file from, press Enter.
  9. Select the directory where you stored the deleted files and press Enter, the deleted files will be listed and select.recover rm files testdisk 05
  10. Press C to recover, then Quit TestDisk.

 

#2 Recover from Backup

If you’ve backed up your Linux files using a command or backup tool, before the files are deleted with rm, it will be much easier to get them back. Just check back the backup location or storage device, then transfer them to a wanted path. It is always smart to backup your files.

 

How to Recover Files after rm on Mac (Free)

Mac users can also delete a file with rm command in Terminal, and the process to recover a file after rm is easier than that on a Linux. If you want to restore a deleted file and not using a piece of software, there are 2 ways as well.

#1 Use PhotoRec

PhotoRec, same as TestDisk, is another free data recovery program from cgsecurity. The application name might make users think it supports photo recovery only. It is not, and it supports more files than TestDisk, including videos, photos, documents, archives and so on. Even, it works on damaged or reformatted disks.

  1. Download and install PhotoRec on your Mac.
  2. Open PhotoRec in Terminal, enter your Mac user password.
  3. Select the disk where you deleted the file from, then press Enter. recover rm files mac 01
  4. Choose the Partition type and filesystem type, then press Enter.recover rm files mac 02
  5. Then choose the destination to save the recovered files.recover rm files mac 03

#2 Recover from Time Machine

If you’ve enabled Time Machine backup on your Mac, the process to recover rm files will be very easy, all you need to do is enter Time Machine and restore the files from your backup.

  1. Connect your Time Machine backup drive to Mac.
  2. Click on Time Machine icon and Enter.recover rm file time machine 01
  3. Go to the place where the deleted file is saved, and select a version from the backup list.recover rm files time machine 02
  4. Then click Restore. recover rm files time machine 03

 

How to Recover Files after RM on Windows (Free)

For Windows users who want to recover files deleted with rm, we will also look at 2 ways. The first one is applicable to the situation that you don’t have a backup, while the second is helpful when you have a backup.

#1 Use Windows File Recovery

Windows File Recovery is a free Windows application to restore documents, videos, photos or others from both internal and external storage devices. It doesn’t have a graphic user interface, you have to enter commands and use arrows on your keyboard to perform the recovery. It is safe and free to use, but the recovery rate will vary in different case, basically lower than those paid ones.

  1. Download Windows File Recovery from Microsoft Store, install and open it in a shell.
  2. Enter winfr source-drive: destination-drive: [/mode] [/switches]
  3. Choose a recovery mode: Regular or Extensive. 
  4. Then input following commands:
    Winfr C: E: /regular /n \Users\<username>\Documents\
    Winfr C: E: /extensive /n \Users\<username>\Pictures\*.JPEG /n\Users\<username>\Pictures\*.PNG. Enter y to continue.recover rm files windows 01
  5. Then confirm by entering y to start the recovery. recover rm files windows 02

 

#2 Recover from File History

File History is considered as one of the best Windows built in tools, it continuously and automatically backs up specific folders to an external hard drive, so you will be able to recover a deleted file after rm from a previous version of the file. It works similarly to Time Machine on Mac.

  1. Connect the backup drive to your PC.
  2. Open Windows search box, enter File History to find and open File History. 
  3. Then click on Restore personal files.recover rm files file history 01
  4. Check the files you want to restore, select a previous version.recover rm files file history 02
  5. Click Restore. 

 

Final Thoughts

There may be other ways to recover a file after rm, however, it is not guaranteed that all the rm deleted files can be recovered. We recommend running Cisdem data recovery for the file retrieval. All of us should hopefully have no such data loss, but it’s a reminder of backing up files onto an external storage device.

avatar
Zoey Wen

Zoey shows a great interest in what she does. Although not long with Cisdem, she has possessed a professional understanding of data recovery.

Comments (0) Leave a Reply

Name *

Comment *

Hot Articles

Recuva Review 2024: What is Recuva? Is Recuva Safe or Free? Recover Corrupted, Unsaved or Deleted AutoCAD File (Online & Free) Is it Possible to Recover Data from Dead Hard Drive? How?
Home > How to Recover A File After RM on Linux, Mac or Windows