Using Cygwin to Boost Your Toolkit

Using command line tools is often very natural for network specialists as that really is the way of configuring the devices in straight-forward way, and traditionally that has made it possible to automate certain things easily. That concept also extends to other environments, and Cygwin is one of my favorite tools on Windows computers because it brings some useful tools to my reach without too much extra effort. Of course I could run Linux or some other system that provides familiar interfaces for CLI work but currently Cygwin just does the job.

So, first of all, I install Cygwin from The setup.exe is really all that is required from there.

Default selection of packages is quite good, but these I’ll add anyway (updated on 6th of December 2012):

  • From Archive: unzip and zip
  • From Editors: vim (because vim just works)
  • From Net: bind, iperf, ncftp, nttcp, openldap, openssh, openssl, rsync, ttcp
  • From Perl: perl
  • From Python: python
  • From Security: pwgen
  • From Utils: bzip2, ipcalc, md5deep
  • From Web: lynx, wget, wput

After finishing the installation I start the Cygwin CLI and do some tweaking with vi of course (you can use some other editor if you like, just select it from the Editors package selection).

In the current directory (my home directory, /home/markku), I edit the .bashrc file with some extra settings:

export HISTCONTROL="ignoredups"
# to remove identical lines from the command line history

export LESS=-M
# to get less to show me more in the prompts

export PS1='\u@\h \w\$ '
# to change the shell prompt to one-liner from the default

alias snmpwalk='snmpwalk -v 2c -c mydefaultcommunity'
# to get decent default parameters for my snmpwalk commands

function sciscoserial {
# this function shows the name and serial number of the
# host given in the command line
# for Cisco devices
 snmpwalk -O qv $@ sysname
 snmpwalk -O qv $@

function shpserial {
# this function shows the name and serial number of the
# host given in the command line
# for HP switches
 snmpwalk -O qv $@ sysname
 snmpwalk -O qv $@

snmpwalk is part of Net-SNMP package.

Now, with Cygwin I can run all my favorite command line goodies like grep, awk, sed, any kind of shell scripts and so on. All shown in above is just a small start! Check also the post from Mike Kantowski on Packet Pushers!

1 Comment

Add a Comment

Leave a Reply