It’s not unusual to hear people talk about “religious wars” taking place among operating systems. Nowhere are the opposing factions more sanctimonious than in the Linux and Windows camps. The rivalry began as isolated skirmishes in the mid-1990s and escalated to all-out war when Windows Server 2008 and later Windows 7 were released.
If you can’t use Linux, the next best thing is Windows with all the Linux goodies added in to create a powerful and usable hybrid system.
It’s time now for negotiations. Not a truce, mind you, just some middle ground where we can meet and decide on a kinder, gentler cooperative strategy going forward.
Cygwin provides the impetus for those negotiations. Cygwin is a software project, owned by Red Hat, that provides Linux-like tools for Windows. Installing Cygwin gives Linux adopters the tools they want to make Windows work better. For Windows folk, it’s a gigabyte of wasted space.
Cygwin software categories include Shells, X11, System Tools, Mail, Admin, Net, Base, Development, Libs, Utils and Databases.
To install Cygwin on your Windows system, point your browser to Cygwin, and click the “Install or update Cygwin now!” link. Doing so starts the setup application that directs you through an installation wizard. If this is your first time, select a mirror site from which to download. Accept the default installation choices by clicking Next, when presented with the categories and package selections.
In a few minutes, you’ll have a ready-to-use Windows-Linux hybrid. The best part — no reboot required.
Now that Cygwin is installed, take a look around the system and see what you’ve installed on your Windows system. Under the Cygwin folder (C:cygwin) are several Linux-type folders: bin, dev, etc, home, lib, srv, tmp, usr, var and the foreign cygdrive. These folders (directories) make little sense to the uninitiated Windows user, but Linux users will find themselves in familiar territory.
You’ll find the bulk of the utilities in the bin (binaries) directory. These are executable files that perform the functions and tasks that make Linux users so happy. Windows users, alternatively, won’t fare so well because Cygwin programs exist in a dark world — one of command lines and text-oriented terminals. To place yourself in the cold darkness of the command line, double click the Cygwin icon that appeared on your Desktop as part of Cygwin’s post-installation activities.
This new environment you see is the BASH prompt, which is similar to a DOS prompt or to a Powershell prompt. You may now execute any of the commands under the /bin directory. Expect the same warm and inviting embrace from a Cygwin BASH prompt that you receive at a Linux BASH prompt.
If you already know Linux commands, you can now fire away on all favorites: ls, ps, cat, grep, sed, awk and so on. You can use your beloved switches with these commands as well. You can create shell scripts, perl scripts, C programs (if you installed it), change file permissions, change file ownership and perform almost every function available on a Linux system. And, an added bonus, scripts that you created in Linux will port to this new environment with little or no modification. For purists, Cygwin also includes vi (vim). The neophyte won’t understand the obsession with this vi thing (the world’s most powerful text editor) but old salts can’t live without it.
Most of Cygwin’s practical application originates from the ability it provides to automate processes through scripting that isn’t available in Windows. Even Window’s new Powershell and its associated cmdlets can’t compare to the power of Cygwin’s utilities and scripting.
You can use Cygwin to automate processes that aren’t easily automated with Windows’ native utilities. Most of those relate to collecting information about the Windows system itself. For example, you can create a script that grabs disk data, trims it down to an easily readable format, and then copies it to an accessible location for easy retrieval or reading.
To interact with disks, you don’t use the standard DOS method of addressing disks as “C:” or “D:”. Instead, use the Cygwin way, which is more Linux-like in its syntax. Disks are referred to as directories, and you can connect to your “C:” drive as /cygdrive/c. Cygwin uses the cygdrive directory under C:cygwin to address the DOS drive references in a way that makes sense to Linux users.
Cygwin can function as a server or enterprise solution for automation, interactive data gathering, scripting, programming or simply interacting with Windows in a new non-graphical way. You can use X Window (Graphical) Linux applications in Cygwin, but it requires additional packages and some advanced skills. This brief introduction to Cygwin and its power should convince you to create some hybrid systems to increase efficiency, to expand your jaded Windows administrator’s horizons, or to satisfy those complaining Linux converts.
It may be a compromise, but it’s a great one.
Ken Hess is a freelance writer who writes on a variety of open source topics including Linux, databases, and virtualization. He is also the coauthor of Practical Virtualization Solutions, which was published in October 2009. You may reach him through his web site at http://www.kenhess.com.