Celeb Glow
updates | March 03, 2026

undo Linux's rm? [duplicate]

Possible Duplicate:
UNDO LINUX Trash Command

Hi,

Is there any simple way to undo an rm command?

The question is purely theoretical; I have NEVER deleted the log of a benchmark queue who took a whole lunchtime to run.

2

3 Answers

On ubuntu or similar:

$ sudo apt-get install trash-cli
$ alias rm=trash

Then put that alias in .bashrc or the appropriate login script for your shell of choice.

The trash-cli package is a command-line interface to the same trash can that GNOME and KDE and other use. So anything you delete via the trash command can be restored by GNOME/KDE and vice-versa.

The other commands in the trash-cli package are trash-list, trash-empty, and restore-trash.

9

The traditional answer is:

You recover the file from the latest backup. You do have a recent backup, don't you?

because on many unix filesystems this simple isn't possible, or is very difficult.

As others have noted this is not the end-all and be-all of the issue any more, but not making mistakes of this kind is still the preferred approach.

5

To prevent hypopthetical future mistakes, you might want to alias rm to rm -i...

3