Unlock the power of the command line Unlock the power of the command line

DevOps Best Practices, Part 3 of 4 – Unlock the power of the command line

DevOps is all about communication, collaboration, and integration between software developers and IT operations. DevOps is basically the glue between the customer and the developer. Over the course of a few articles, we’re going to list 4 best practices you can follow to be an effective DevOps professional in a Windows environment.

  1. Automate only what is necessary
  2. Regularly check system resources
  3. Unlock the power of the command line
  4. Communicate!

3. Unlock the power of the command line

Unlock the power of the command lineCommand line tools can be a very powerful weapon, if used effectively. Many command line utilities exist that allow you to quickly and easily perform many common tasks. Every good Windows DevOpeler should be familiar with PsTools (http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx) to help administer Windows workstations and servers. PsTools gives you commands for things like viewing process tables remotely, running processes remotely, killing processes remotely, etc.

Do you need to know how long a server or workstation has been up? A common way to do this in Windows 7 is to walk over to the machine, fire up the Task Manager, and look at the Performance tab. Alternatively, you can combine psexec with ‘net stats srv’ and get the same information for any Windows computer on your network (that you have access to of course) without leaving your desk or interrupting others.

Also, even though you’re on Windows doesn’t mean you should ignore Unix. With tools like Cygwin you can simplify many tedious tasks especially around text processing. Get familiar with Unix commands like find, grep, sort, and uniq. You can save huge amounts of time by knowing how to write one-off command lines to do things like transform a text file that is a long list of values, with each value on its own line, into a comma-separated list of values all on a single line.

Awk and Perl can be helpful too, but be mindful of your goal. One-offs or throw-away command lines and scripts are fine for isolated tasks but if you’re being asked to run this command line or script regularly, consider building a proper application or collaborating with your development group for their assistance.

And of course, Microsoft’s own scripting language, PowerShell should be in every good Windows DevOpeler’s tool belt. PowerShell exposes the power and flexibility of the .NET Framework in the context of a scripting environment.

  1. finally windows has a scripting language that matches and I think surpasses the linix/unix enviornment. go powershell.

Leave a Reply

Your email address will not be published. Required fields are marked *