Source is http://www.faqs.org/docs/Linux-HOWTO/Bash-Prompt-HOWTO.html#...
jcs@smug:~% echo asdf > file
jcs@smug:~% echo fdsa > file
file: File exists.
jcs@smug:~% echo fdsa >! file
jcs@smug:~%
this has saved me quite a few times when accidently typing > instead of >> or similar.For example, when using typical Unix terminals, I refuse to mouse copy/paste when logged in as root (whether or not the prompt is nearby), because it's too easy to make a mistake and the consequences are severe. Similarly, I refuse to rely on any cute shell tricks like "!" to pull history items when logged in as root. Sacrifice convenience to guarantee safety.
I also prefer to use my Mac terminal (MacTelnet), which will trap multi-line pastes and offer options to paste as-is, paste as one line, or cancel the operation. This has saved me more than once.
(Certainly there are a few things I don't know about administering large groups of machines. However, I've been running my own personal Linux boxes for a while. And the last time I logged in as root was a bit over 9 years ago.)
Don't ever use ">" in your prompts, particularly as root.
A coworker had spent several days working on* an important script with a tight deadline that was almost upon him, and with a quick slip of the right mouse button, pasted what he had selected before (several lines of window scrollback) into the window to be executed, including:
/tmp/foo> ./blah.pl
and just like that, blah.pl ended up zero length. We hard killed the machine and scanned the disk for the contents of the script and recovered most of it, but had the specifics been different we could have been a lot less lucky.
For this reason it's probably also a good idea to avoid question marks, asterisks, and anything else the shell could expand, as well.
* While the story plays just as well, it's not meant to be an argument for source control. It could have just as easily been full paths to system binaries and have ended up trashing the system.