

Ask HN: Most embarrassing command line gaffes ? - jacquesm

What is your most embarrassing command line blunder ?<p>I've noticed that as you get more proficient in using the command line you go ever faster and sometimes an accident is only a typo away.<p>Mine was without a doubt the following:<p><pre><code>    rm -rf * .bak
</code></pre>
And then getting a cup of tea while all the backup directories were removed ;)<p>Let's just say it's good to have backups. So, now whenever I use the famed 'rm' with anything that is either a wild card or a recursive option I look it over three times before hitting that return key.<p>If there are other pitfalls like that I'd like to know about them before experiencing them in practice, so please share.
======
davidw
When I first got a 'portable' computer with Linux on it, in 1996, I was trying
to use 'tar', but didn't remember the right options to pass to it, and wasn't
on line (so no irc or what passed for search engines at the time). Those days,
the man page wasn't very helpful in showing the 'commonly used' options, so
somehow I ended up with the partition specified, and overwrote the partition.
Oops!

------
noonespecial
_!sh <enter>_

trying to get the last server I ssh'ed back and getting

 _shutdown -h -t 0_

on a _very_ remote server instead. My audible "doh!" and desperate "init 3"
did not save me. Fear the !.

~~~
lucumo
You might be interested in a program called "molly-guard". It overrides
shutdown/reboot/halt/poweroff with a shell script that detects if you're in an
ssh session. If that's so, it will prompt for the hostname of the host you
want to shutdown.

It has saved me a few times.

------
fexl
When I'm extremely cautious I'll do something like this first:

find . -name " _.bak" -exec echo rm -fv {} \;

That will print out the commands it _would* do. If I like what I see, I simply
run the command again without the "echo".

------
fexl
Pardon me while I practice the "code" tag to avoid my posts getting botched:

<code> find . -name "*.bak" -exec echo rm -fv {} \; </code>

Thank you <b>very</b> much.

------
chaosprophet
Wiping out my Master Boot Record using dd. I interchanged if and of. And to
think I was explicitly cautioned against this...

Needless to say I've been quite careful with dd since then.

------
fexl
Oh I give up.

