AVAILABLE: 5
Windows command-line tools have made significant progress with PowerShell, but Linux has offered a much more versatile terminal for years. Here's how you can get the best of both worlds with Cygwin, a 'nix-style terminal for Windows.'
This guide aims to explain how to successfully set up Cygwin on your Windows device. Stay focused—and maybe grab a cup of coffee first.
Install Cygwin
Cygwin comes with a setup.exe
installer for Windows, but there are a few steps you should pay attention to, and we’re here to help.
To minimize bandwidth usage during the Cygwin installation process, the default installer will only download the files necessary for setup.
By default, the installation path is set to C:\Cygwin
, but you can change it to a different location—just make sure not to place it in the trash bin 😃.
Click "Next" until you reach the dialog for choosing a download mirror. Unfortunately, the installer doesn’t detect your location to provide recommendations, so you’ll need to estimate which mirror server is best for you.
After selecting a mirror, the installer will download the available packages from that mirror and install them on your Windows system. This is part of Cygwin’s effort to maintain system security.
There are hundreds of packages available, grouped into several categories. If you’re unsure which packages to choose, leave the default settings as is.
However, if you know which packages you might need, don’t hesitate to select them.
Click "Next" and wait a few moments for the download and installation process to complete.
Add Cygwin Path to Windows Environment Variables
Once installed, you’ll have a Cygwin icon on your desktop, which you can launch to open the Cygwin terminal.
The terminal starts in the folder C:\Cygwin\home\<user>
. However, this location may not be very useful since you likely don’t store files there. You can use all basic Linux commands, but if you want to access your C: drive, you’ll need to switch directories to /cygdrive/c
.
To make Cygwin work directly from the Windows Command Prompt, you’ll need to add Cygwin to the Windows Environment Variables.
Steps:
- Open your system properties by pressing Win + Pause/Break, or right-click on "This PC" and select "Properties."
- On the left-hand side, click Advanced System Settings to open the System Properties window.
- Under the Advanced tab, click Environment Variables at the bottom.
- In the System Variables section, locate the
Path
variable and click Edit. - Add the following to the end of the variable value:
;C:\Cygwin\bin
Note: Be sure to include a semicolon (;
) to separate it from the existing values. - Click OK to save your changes.
Open the Command Prompt and test some Linux commands.
As shown in the image below, both pwd
and ls
work in the Windows Command Prompt. You’ll also notice that the /cygdrive/c
directory is automatically added.
What’s Next?
There’s much more you can do with Cygwin, and we’ll introduce some additional useful tools in upcoming articles.