Cygwin is a Linux-like environment for Windows-based systems. It consists of an emulation layer and a collection of tools that provide a Linux look and feel.

It consists of a DLL (cygwin1.dll), which acts as an emulation layer providing POSIX system call functionality over Windows. With Cygwin, users have access to standard UNIX utilities, which can be used either from provided bash shell or through Windows Command Prompt.

Besides, it provides support to programmers to make use of Win32 API along with Cygwin API, allowing to port UNIX utilities to Windows without much change in source code.

Advantages of Cygwin over Command Prompt/WSL

There are certain advantages of using Cygwin shell over Windows Command Prompt. Listed below are some of the major ones:

  • Provides UNIX shell to Windows, allowing access to a range of utilities from UNIX/Linux world to Windows.
  • There is no need to install a full-fledged Linux OS or set up a VM where the requirement is satisfied by resources available via Cygwin.
  • Optimal resource usage and system requirements to run on Windows since the environment is emulated and works on top of Windows.
  • Ideal for testing/development where the requirement is to use UNIX/Linux utilities on Windows.
  • Compatible with older Windows OS like Windows 7 etc., whereas the WSL environment offered by Windows is supported on newer versions only.

Download

To download the latest version of Cygwin, follow this link to its official website. You can download the version suitable for your Windows installation and system’s architecture. For the 32-bit version, download https://cygwin.com/setup-x86.exe and for the 64-bit version, download from here https://cygwin.com/setup-x86_64.exe.

Installation

  • Launch the downloaded executable file from the previous step. Accept any prompt and warning that is displayed on-screen from Windows User Access Control. This will launch the setup program as shown below.

What is Cygwin and How to Install on Windows? Sysadmin windows

  • Click “Next” to continue with the setup process.

What is Cygwin and How to Install on Windows? Sysadmin windows

  • A prompt to select a download source will be displayed. For most cases, the default option to “Install from Internet” is okay and should be kept. If you’ve a local downloaded repository or just want to download and install Cygwin later, choose one of the other available options. Click “Next” to continue.

What is Cygwin and How to Install on Windows? Sysadmin windows

  • It prompts you to specify “Root Directory” for the install as well as whether it’ll be installed for “All Users” or “Just You”. Again if there isn’t a specific need, keep the default options and click “Next” to continue.

What is Cygwin and How to Install on Windows? Sysadmin windows

  • To download the package files, the setup will ask you to specify a “Local Package Directory” which by default points to your system’s “Download” folder. In case you want to specify another location, specify its path here and click “Next” to proceed with the setup.

What is Cygwin and How to Install on Windows? Sysadmin windows

  • For most cases, “Using System Proxy Settings” should work for the downloading of packages. If you don’t intend to use any proxy and use a direct connection to the Internet, use the “Direct Connection” option, or you can specify a custom proxy setting as well. Click “Next” to continue.

What is Cygwin and How to Install on Windows? Sysadmin windows

  • Next, it’ll prompt you to select a mirror from where Cygwin will download its package files. If a mirror is near your location, which can provide faster speed, choose that one from the list. If you’re unsure, select anyone from the list and click “Next” to proceed.

What is Cygwin and How to Install on Windows? Sysadmin windows

  • Cygwin provides a lot of UNIX/Linux-based utilities that run on Windows. Not all packages get installed by default. Only a minimal set of important packages gets installed. In this step, you can customize your Cygwin setup by selecting/un-selecting different categories of packages. Remember, this can also be done later to add/remove packages to your Cygwin installation. If you have a specific list of important packages for your work, you can select them now and continue further by clicking “Next”.

What is Cygwin and How to Install on Windows? Sysadmin windows

  • The next screen lists the selected packages and asks you to review and confirm. Click “Next” to confirm and continue.

What is Cygwin and How to Install on Windows? Sysadmin windows

  • The selected packages will begin to download, and this may take a while depending upon the speed of the selected download mirror and the number of selected packages.

What is Cygwin and How to Install on Windows? Sysadmin windows

  • Once all packages are downloaded, the setup will continue to install the packages.

What is Cygwin and How to Install on Windows? Sysadmin windows

  • When setup is complete, you’ll be shown the option to create icons on Desktop and Start Menu for easy access. Click “Finish” when done to end setup wizard.

What is Cygwin and How to Install on Windows? Sysadmin windows

  • You can now launch Cygwin by searching in Start Menu as shown above or double-clicking the Desktop icon (if created during setup). This will launch the Cygwin shell.

What is Cygwin and How to Install on Windows? Sysadmin windows

  • Cygwin shell supports UNIX/Linux commands that you normally use. If you find any specific command is not working, you can re-run the setup and select the missing package, if available from the Cygwin repository (an example – Ansible), and install it. The installed command should now become available as a normal command in Cygwin shell CLI.

Conclusion

Cygwin is a useful utility that provides a UNIX/Linux-like shell emulated over a Windows environment. It makes it easy to port certain specific applications on Windows and allows you to develop and use Linux-based scripts on Windows for various tasks. Its installation is as simple as any Windows-based program with GUI based setup.

To read more about Cygwin, you can find its documentation here. Refer to its FAQ and its user guide for detailed usage instructions.