Never Use rm After Seven
By seapegasus on Mar 21, 2006
It should be internationally outlawed and illegal to delete files after more than eight hours at work. Especially, the
rm command should check the local time and say, Sorry dude, you're no longer certifiably sane, and no, the fact that you are still able to type
:%s/smf/and/g into vi doesn't mean your wide awake, it means you're too tired to spell "and" correctly. (In my own defense I have to add that this is only a made-up example.)
But the following really happened -- I just deleted the directory I was working in. \*BONK\* I mean, there was a lot of stuff taking up space on my harddrive, and I just thought, hey, it's cvs, I can delete it locally, right? Just maybe I should have skipped deleting the dir I had checked out and just had started making changes in. Changes I had not yet commited back to cvs yet. So what to do?
Not to worry! Luckily, it was only two HTML files, and when I work with HTML, I usually keep a browser preview of the local file I'm working on. The files I deleted were still open in the browser. So just save them and I'm fine, right? Problem is -- the browser doesn't save from its cache. It tries to access the real thing before saving. Which didn't exist anymore.
Let's try something else. I can select the text in the browser and copy&paste it into a text document, but then I'd lose all formatting. Well -- better than nothing anyway. Luckily being tired doesn't only make you think in strange ways that make
rm -rf look like a space-efficient backup command. Sometimes being tired is good for lateral thinking: Is the formatting really not preserved in the clipboard? What would happen if I paste it into an HTML editor? Only, since I hardly ever use an HTML editor, I couldn't think of any. Hmmm. My very first webpage I think I made in Netscape Composer. Netscape doesn't exist any more. Probably got accidentally deleted after seven. So let's try 'mozilla'. Lo and behold, my Fedora has mozilla installed. And even loer and beholder -- it still works exactly the same as netscape! Just choose Composer from the Windows menu and you have at least some HTML editor. I paste the clipboard and ta-daa -- my file is back in all its HTML glory. Composer didn't even get time to insert its annoying 'compliance' tags. :-p I only lost the meta tags, but they are easily restored.
And the moral of the story: Not only backups, but also caches, clipboards and old Composers can be your friend.