Nrm is a replacement for rm(1) that allows files to be easily recovered. Depending on your taste, you can either alias rm to nrm in your .bashrc file, or just call nrm directly when you need the protection.
The basic idea is to put deleted files into a hidden subdirectory named "./.gone" so that it stays near its original location in the filesystem. This avoids the problem of having multiple files of the same name colliding in a global "~/.trashcan" directory. This strategy also makes it easy to purge deleted files in just a subsection of the filetree.
A simple cron(1) . job removes deleted files older than 3 days (a configurable number), and will also remove empty .gone directories.
Yes. Nrm(1) comes with a scripts called ncp(1) and nmv(1) which are safe replacements for cp(1) and mv(1) and protect the user from overwriting a target file. Nrm also has facilities to provide sequenced backup copies of deleted files. Rather than just moving the file "foo" to "./.gone/foo", "Nrm -s" will time-stamp the save file with a name like "./gone/foo-93-05-09-21:32:17". This feature is handy for keeping check-point copies of engineering databases or critical documents. We have some of our CAD tools configured to nrm(1) the existing database before saving a new version. It's nice to be able to back out any change made over the last 3 days.
A large amount of effort went into making nrm(1) duplicate rm(1)'s error return codes, error messages, etc., under all the wierd corner cases of deleting sym-links, dev-files, etc.. Nrm(1) attempts to duplicate the GNU rm(1) command line options so that it can be seamlessly substituted for rm(1) in legacy scripts.
This program is the first line of defense allowing most non-super users to recover from simple errors without having to bother our back-up guru for a tape restore. I still would recommend behaving as if your rm(1) were a loaded gun, but if you still fumble it, then nrm(1) will make the reconstruction a lot easier.
Several heuristics were used in the code to make Nrm as fast as possible for most usages. In most cases, Nrm is very nearly as fast as just a rename(1) call. It does this by assuming first that "foo" is a regular file, and then falling back to more complex actions based on the initial error return code. This avoids an extra stat(1) under most common cases.
When time-stamping .gone files, Nrm uses a hash technique to avoid slow searches through the .gone directory.
Sure. Check out the man page here .
A ~21kbyte compressed tar file is available here . Unpack with "zcat nrm.0.1.src.tar.Z | tar xvf -". After that, a "make" and a "make install" should get you going. You'll also need to manually create a cron job for root to periodically run the permanent cleanup script. See the README for more details.
I hope you enjoy nrm, and that it saves you a bit of grief some day.