Installing and Using Cygwin

Cygwin is a Linux-like environment that runs on Windows PCs.  It can be used for many things, from granting a Windows user access to bash and bash-like shells to remotely accessing your other computers and using rsync.  An X11 client is available from the Cygwin package repository, allowing you to run many X windows applications from a Windows machine.

Downloading and Installing Cygwin

The following steps cover downloading and installing Cygwin.
 

1. Download the Cygwin setup.exe executable from the Cygwin home page.

2. Run the setup.exe executable.  This will prompt you to select a download method.  Select "Install from Internet".

3. Set the Root Directory to the path you want Cygwin to be installed to.  Use the default path of C:\cygwin if you have no preference.  The section labeled "Install For" is a personal preference.  It will only affect which users receive Cygwin icons on their desktop and in their Start Menu.

4. Cygwin maintains a local copy of the packages it downloads.  These may be used during a later setup run for reinstallation, or for ease of deployment over multiple systems.  By default, the package directory is set to the same directory that Cygwin is installed to.  You may elect instead to store your packages in your Windows Downloads folder, or in any other folder.  Click Next when you have provided a directory for package storage.

5. Select 'Direct Connection'.

6. Select a mirror to download packages from.
 

7. In the 'Select Packages' dialog box, browse for any additional software packages you wish to include in your Cygwin installation.  Cygwin's repository includes a wealth of tools and other software which you might find useful in augmenting the tools provided by Windows.  You may skip this step if you wish to install only the Cygwin core.
 

You can quickly search for available packages by keyword using the search box.

To select a package for installation, find the package listing and click on "Skip" until it shows a package version number.

If you already know that you will be using secure shell remote access to other computers, you may save some time here by selecting package openssh for installation.  Similarly, if you plan to use X11 forwarding with SSH, select packages openssh, xorg-server, and xinit.  A Cygwin install with the mentioned Cygwin/X packages selected uses approximately 240 MB, with about 70 additional MB used by local package copies.

Click Next when you have selected all the packages you wish to install.

8. Cygwin will ask you to confirm that you want to install dependencies.  Click next to begin installation.  If you selected the packages for X11 and SSH, installation should take less than ten minutes.
 

9. The last step of the Cygwin installer will allow you to create shortcuts on the start menu and desktop. If you choose to not create a shortcut, you can start Cygwin by running cygwin.bat from the directory you installed Cygwin into.

Basic Cygwin Usage

To start Cygwin, open a terminal.  Cygwin provides different terminals for you to use, with the default being Cygwin's own 'mintty'.  Cygwin will print that it is "copying skeleton files".  This is automatic setup of your home directory.

Directory navigation in Cygwin is Unix-style (cd, ls, pwd, et cetera).

Cygwin's directory structure strives to emulate that of Unix and its descendents.  You may notice that your Cygwin home directory is located at /home/<account_name>/, a path not possible under Windows.  Cygwin establishes its root directory as the directory you installed Cygwin into.  If you installed Cygwin into C:\cygwin (the default), your home directory is actually located at C:\cygwin\home\<account_name>.  Cygwin mounts all other detected devices and partitions (including your primary hard drive with Windows installed) in /cygdrive/.  Thus, you could alternatively access your home directory via /cygdrive/c/cygwin/home/<account_name> (but why would you want to do that?).  Unfortunately, it is not possible to path infinitely deep by continually navigating to the cygdrive/ directory located in your cygwin installation folder.

Cygwin is not a Linux installation trapped in a virtual sandbox.  You can directly interact with your Windows files using Unix/Linux commands, while still in Windows, and often in ways that Windows might not let you do normally.  This can be quite powerful, but also carries the same inherent risk that misusing Linux commands within Linux carries (for more information, search the web for "dd disk destroyer").

Your $PATH variable in Cygwin by default is the standard /usr/local/bin:/usr/bin lines prepended to your Windows path variable.  This means that, out of the box, Cygwin will allow you to run many Windows programs as if you had typed them into the Windows "Run" menu.  You can even run the Windows command line in Cygwin if you want to (which might possibly be a cardinal sin).  Cygwin programs will win any name collisions with Windows programs, due to Cygwin directories being searched first.

As you might expect, Cygwin allows you to customize your terminal settings across sessions using the same dot files as Linux or Mac OS X.  One useful customization might be to put the following lines at the end of your .inputrc file (found in your home directory):

# Allow cursor jump by word "\e[1;5C": forward-word "\e[1;5D": backward-word

For more detailed information about Cygwin and its usage, please consult the Cygwin documentation.

Back to Top