Skip to content
Advertisement

How to undo rm -rf? [closed]

How we I undo the rm -rf command?

For example, I have an Application folder and I removed it with:

rm -rf Application

But it was my mistake and want to recover that Application folder, but it’s not in Trash folder.

What should I do now? Is there any command to undo rm -rf?

Advertisement

Answer

Short answer: you can’t¹. 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 photorec and try to recover as many files as possible, but you will loose any directory structure and naming.

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


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

Advertisement