Linux 如何撤消rm -rf?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21296485/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 01:53:19  来源:igfitidea点击:

How to undo rm -rf?

linuxmacoslinux-kernelubuntu-12.04linux-mint

提问by Amrit Dhungana

How we can undo rm -rf command ? For example, I have Application folder. And I have remove it by

我们如何撤消 rm -rf 命令?例如,我有应用程序文件夹。我已经将其删除

rm -rf Application

But it was my mistake and want to recovery or want that Application Folder. But its not in Trash folder. What should I do now ? Is there any command to undo rm -rf .

但这是我的错误,想要恢复或想要那个应用程序文件夹。但它不在垃圾箱文件夹中。我现在该怎么办 ?是否有任何命令可以撤消 rm -rf 。

采纳答案by Stefano Sanfilippo

Short answer: you can't1. Files that get unlinked are irreversibly gone. If you really cared about what you deleted (e.g. personal files that cannot be reproduced), you could run photorecand try to recover as many files as possible, but you will loose any directory structure and naming.

简短的回答:你不能 1。取消链接的文件不可逆转地消失了。如果您真的关心您删除的内容(例如无法复制的个人文件),您可以运行photorec并尝试恢复尽可能多的文件,但您将丢失任何目录结构和命名。

Anyway, since you deleted the Applications folder, reinstalling everything could be the simple way to go. Provided that Applications folder contained installed applications.

无论如何,由于您删除了 Applications 文件夹,重新安装所有内容可能是一种简单的方法。前提是 Applications 文件夹包含已安装的应用程序。



1: some filesystems (will) support undeletion, but it's not your case.

1:某些文件系统(将)支持取消删除,但这不是您的情况。