Command line safety tricks

Posted by deadprogrammer on Server Fault See other posts from Server Fault or by deadprogrammer
Published on 2009-05-22T15:41:17Z Indexed on 2010/06/08 12:32 UTC
Read the original article Hit count: 417

Filed under:
|
|

Command line and scripting is dangerous. Make a little typo with rm -rf and you are in a world of hurt. Confuse prod with stage in the name of the database while running an import script and you are boned (if they are on the same server, which is not good, but happens). Same for noticing too late that the server name where you sshed is not what you thought it was after funning some commands. You have to respect the Hole Hawg.

I have a few little rituals before running risky commands - like doing a triple take check of the server I'm on. Here's an interesting article on rm safety.

What little rituals, tools and tricks keeps you safe on the command line? And I mean objective things, like "first run ls foo*, look at the output of that and then substitute ls with rm -rf to avoid running rm -rf foo * or something like that", not "make sure you know what the command will do".

© Server Fault or respective owner

Related posts about unix

Related posts about command-line