recover a lost file.....(aka, i messed up, hard)

Matan Nassau matan.nassau at gmail.com
Tue Oct 4 14:12:39 UTC 2005


On 10/4/05, Thomas Beckett <thomas.beckett at gmail.com> wrote:

[snip]

>  to stop it happening again
> could an alias be set up such as rm=mv $1 ~/.trash

You could do something more complex, like going through the arguments
passed to rm and deciding which are good and which are not for mv, but
I wouldn't do that. We all know that the interface of both rm and mv
is pretty stable, like it won't change soon, because it hasn't changed
for a long time---but who knows. And there's also a simpler solution.

I would suggest something more like a function in ~/.bash_profile (or
whatever profile file you use):

rm () { rm -iv $@ }

This makes rm interactive, prompting you for every file before any
action is actually taken. You should be able to add -f when you
actually rm'ing, to overide that and force the action---but that
wouldn't be a good idea. When you're sure 99.9% you know what you're
doing (there's never a 100%), mv to ~/.Trash instead.

Then you're left with maintaining your trash once a month or so... :)

As to how do we get the file back... I'm not sure I know. ext3 is a
journaling filesystem, there must be something!


--
MN




More information about the ubuntu-users mailing list