Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to recover the deleted files using "rm -R" command in linux server? [closed]

Tags:

I have unfortunately deleted some important files and folders using 'rm -R ' command in Linux server.

Is there any way to recover?

like image 661
Srini Avatar asked Nov 03 '14 19:11

Srini


People also ask

How do you recover a file deleted by rm command in Linux?

To recover deleted files you will be provided with a single file recovery option and all files recovery option. If you want to recover a single file, you can go with “-restore-file”. On the other hand, if you want to restore all deleted files, you can go with “-restore-all”.

How can I recover deleted files in Linux?

Select Trash from the left sidebar to access the Trash. Right-click on the file, choose Restore from Trash to recover the file and move the file back to its original location. 3. Finally, navigate to your deleted file's original location to see the successfully restored the file.

Can we restore rm command in Linux?

Usually, running the rm command tells the system to label the inode and the data blocks of the file as unused. In older Linux versions, it used to be possible to retrieve the data, but nowadays, the metadata is wiped, and nothing is recoverable.


2 Answers

since answers are disappointing I would like suggest a way in which I got deleted stuff back.

I use an ide to code and accidently I used rm -rf from terminal to remove complete folder. Thanks to ide I recoved it back by reverting the change from ide's local history.

(my ide is intelliJ but all ide's support history backup)

like image 99
Shishir Arora Avatar answered Oct 06 '22 16:10

Shishir Arora


Short answer: You can't. rm removes files blindly, with no concept of 'trash'.

Some Unix and Linux systems try to limit its destructive ability by aliasing it to rm -i by default, but not all do.

Long answer: Depending on your filesystem, disk activity, and how long ago the deletion occured, you may be able to recover some or all of what you deleted. If you're using an EXT3 or EXT4 formatted drive, you can check out extundelete.

In the future, use rm with caution. Either create a del alias that provides interactivity, or use a file manager.

like image 26
yossarian Avatar answered Oct 06 '22 14:10

yossarian