undelete in FreeBSD?

Mario Hoerich lists at MHoerich.de
Sun Jul 24 05:16:56 GMT 2005


# Aaron Siegel:


[ there is no un-rm ]
>
> One option I have seen for creating your own restore is to create a script 
> that will move files you want to delete to a temporary directory, a "Trash 
> Bin". Then use your shells aliases to alias the script to the rm command. 

Don't *ever* create aliases for rm(1).  rm's sole purpose in
life is to destroy files.  If you tame it, you'll eventually
adapt and rm with less caution.  There are lots of people who
eventually got bitten by that when working on a machine other
than their own.  

A better way is to use a name like "[tT]rash" or "tt" (=[move]
to trash).  That way, when working on a machine without your
script, you'll get a nice and friendly "command not found"
reminding you there's no safety catch.

I'm personally none too fond of this, though.  Unixoid systems
have quite a lot of ways to destroy files.  Trashes won't really
protect you from that.  Instead, they just give you a false
feeling of security, which merely encourages sloppiness.  

My own solution is actually quite simple:
I treat dangerous commands the same way I'd carry a deadly and
pretty annoyed snake: with my thoughts on the task at hand.
I read the command *before* I hit enter.  Not the one I 
*think* I've written, but the one I'm about to execute.
I also tend to tab-expand globs to see which files are
actually affected.

YMMV, though.

Cheers,
Mario


More information about the freebsd-questions mailing list