How to really shoot yourself in the foot with Unix

Written August 10, 2003

Unix is the ideal operating system for me. I have used it in one form or another (SunOS, VAX 4.3BSD, Solaris, Linux) since 1987 and I'll stop using it when you pry the keyboard from my cold, dead fingers.

Unix is tremendously powerful, both at getting things done, and at magnifying mistakes. The most obvious one is when you want to do something like

   rm -rf *.tmp
but you make a typo and instead type
   rm -rf * .tmp
That's not really worthy of fame, everyone does that once and from then on stops to think before hitting return on an rm command. Here is a nasty one though, that cost me six months of received email a few years ago. I logged into the remote system which, at the time, I was using for email and intended to back up my mail folders with
   tar cf - inbox outbox | gzip >~/mail.backup.tgz
Guess what, I forgot the "-". Thus overwriting the inbox file with the tarred version of the outbox file. On a Unix file system on a machine that was actively doing stuff. The inbox file was lost with no hope of recovery.

My more recent disaster is a real classic. I had spent all afternoon making changes (inserting about 150 direct hyperlinks to relevant photos in the master source file for this trip log) in the vi editor which, like Unix, I've used since 1987. This involved pasting picture ID strings in. Well, sometimes you forget to go into insert mode first, and the string is pasted as a command. This usually makes some changes to your file and leaves you in insert mode, so you hit escape, undo, and retry the operation. This I did.

I'm not stupid, so I save my work every few minutes with :w. Well, after hours of continuous editing and saving, I quit the editor and ran the perl script that makes the various HTML versions from the master file. Only to find that most of my work was gone! There were a few hyperlinks at the very beginning, a few at the very end, but all the work in the middle, including hours worth of proofreading and spelling and grammar corrections, was missing! What on earth happened?

What happened, was that I had done a paste, not in insert mode, of a string like this:

    20030731_083105u
There was no way to recover the lost work. After the shock wore off, I decided that my trip log would just be the worse for it, and removed the remaining direct hyperlinks too.

I'll add to this when I make my next big mistake!

Keep in mind, this is not an anti-Unix rant. On the whole, Unix has saved me far more work than it has wasted in disasters like this.

Back to my miscellaneous technical stuff page