linux terminal undo rm 'somefile' [duplicate]

Possible Duplicate:
undo Linux's rm?

is it possible to undo a rm somefile command in linux?

and if so, how does one do that?


rm doesn't move the file to some trash directory, it deletes it. Thus you cannot, in normal ways.

You could try with some tool to find removed files on the filesystem. If you want to try I suggest you to immediately unmount your filesystem and not mount it (in readwrite) until you found back your files or until you give up.

If you're scared of removing files, you should replace your rm command with another one that asks confirmation before permanently remove files. You can use an alias to this purpose:

alias rm="rm -i"

Not normally, no - it's been deleted, and there isn't normally an undelete comand. It's for that reason that the very first thing that my first Software Engineering professor told the class to do was to redefine the rm command to mv (move) the file(s) to a .trash folder.