What is Cygwin Linux Tools
Cygwin Tools are GNU and Open Source tools that provide Linux like functionality on Windows, which include applications like ls, bash, gcc, g++ and numerous others. “BASICALLY”, it is a set of Linux tools that were ported to Windows. If you want to fully understand how it works, better check their FAQ for more details.
Affiliate: Experience limitless no-code automation, streamline your workflows, and effortlessly transfer data between apps with Make.com.
How to install Cygwin Linux Tools
1. Navigate to Install Cygwin page on their site.
2. Download the “setup-x86_64.exe” from the first link you see.
*** There are silent switches available, where you can choose any package you want in one line. For help run in “cmd.exe”:
setup-x86_64.exe -h
3.a. Execute the installer and follow these steps:
"Cygwin Net Release Setup Program" [Next] "Choose A Download Source" (*) Install from Internet [Next] "Select Root Install Directory" Root Directory: C:\cygwin64 *** This is default path. I would not recommend changing it, since it will be easier later to find it for the PATH variable and troubleshooting. Install For: (*) All Users (RECOMMENDED) *** As with "Root Directory" it is better to use default. [Next] "Select Local Package Directory" *** This is the directory that Cygwin installer will download all the setup packages. You can use them offline later. The default directory is the one that installer executes from. I prefer it somewhere inside Cygwin directory. Local Package Directory: C:\cygwin64\Downloads [Next] "Select Your Internet Connection" *** Self-explanatory - if you have any other settings, just select them. (*) Use System Proxy Settings [Next] "Choose A Download Site" *** Personally, I select the first one that have "https" in it [Next] "Select Packages"
3.b. There are countless packages available for Cygwin. Each purpose will require different packages installed. If you will not choose any packages – it will install only the basic set of Linux command executables.
[Next] "Review and confirm changes" [Next] *** Your packages will download to the directory we specified earlier. Our example: C:\cygwin64\Downloads "Create Icons" *** As you like [Next]
4. After the installer has finished, we need to add the full path of the “bin” directory into PATH environment variable (if you will not set this, you will have error while executing dependencies of Cygwin executables):
. Open Control Panel => System On the left pane click "Advanced system settings" => [Advanced] tab will open Click [Environment Variables...] on the bottom "System Variables" (bottom pane) => Select [Path] => [Edit...] *** Add full path of the "bin" directory [New] => c:\cygwin64\bin [OK] [OK] [OK] . Close System window
Cygwin library DLL
If you compile a source code with any of the Cygwin compilers (like g++) you will need to provide “cygwin1.dll” along with the compiled executable if you want to run it on another host. The DLL is in the “bin” folder:
C:\cygwin64\bin\cygwin1.dll
*** Since it is already in “bin” folder you do not need to provide it on the compiler host – it is in PATH Environment Variable already.
It is enough to place the DLL on the target host in the same directory as the compiled executable. If it will not work, place the “cygwin1.dll” in the “C:\Windows\System32” folder on the target host, since it is already in the PATH Environment Variable.
Dependency errors on execution of Cygwin components
For example, you execute “g++” and you get a similar error:
C:/cygwin64/lib/gcc/x86_64-pc-cygwin/10/cc1plus.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
This means the component “cc1plus.exe” (that is linked from “g++.exe”) with full path of
C:/cygwin64/lib/gcc/x86_64-pc-cygwin/10/cc1plus.exe
is missing shared dependencies. This can happen if you did not add the “bin” folder into PATH Environment Variable. If it is not the case, you can use Cygwin dependencies checker “cygcheck.exe” with the problematic executable. Run in “cmd.exe”:
C:\cygwin64\bin\cygcheck.exe C:/cygwin64/lib/gcc/x86_64-pc-cygwin/10/cc1plus.exe
You will need to provide full paths to both, since it can be a problem with Environment Variables.
Sample output if the missing libraries:
C:\cygwin64\lib\gcc\x86_64-pc-cygwin\cc1plus.exe cygcheck: track_down: could not find cygwin1.dll cygcheck: track_down: could not find cyggmp-10.dll cygcheck: track_down: could not find cygiconv-2.dll cygcheck: track_down: could not find cygintl-8.dll cygcheck: track_down: could not find cygisl-22.dll cygcheck: track_down: could not find cygmpc-3.dll cygcheck: track_down: could not find cygmpfr-6.dll cygcheck: track_down: could not find cygz.dll cygcheck: track_down: could not find cygzstd-1.dll C:\Windows\system32\KERNEL32.dll C:\Windows\system32\ntdll.dll C:\Windows\system32\KERNELBASE.dll
Only the last 3 libraries are in place.
Sample output if the libraries that are not missing:
C:\cygwin64\lib\gcc\x86_64-pc-cygwin\cc1plus.exe c:\cygwin64\bin\cygwin1.dll C:\Windows\system32\KERNEL32.dll C:\Windows\system32\ntdll.dll C:\Windows\system32\KERNELBASE.dll c:\cygwin64\bin\cyggmp-10.dll c:\cygwin64\bin\cygiconv-2.dll c:\cygwin64\bin\cygintl-8.dll c:\cygwin64\bin\cygisl-22.dll c:\cygwin64\bin\cygmpc-3.dll c:\cygwin64\bin\cygmpfr-6.dll c:\cygwin64\bin\cyggcc_s-seh-1.dll c:\cygwin64\bin\cygz.dll c:\cygwin64\bin\cygzstd-1.dll
If you make some changes to Environment Variables, you will need to close the CMD and run it again, so the changes will apply to the CMD.
Basic Cygwin Terminal Usage
If you added the shortcut during installation you will see “Cygwin64 Terminal” shortcut on your Desktop. if not, you can find the terminal here:
c:\cygwin64\bin\mintty.exe
If you want to add the shortcut for yourself, the full “Target” of the shortcut by default is:
c:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -
The above ICO file is in “c:\cygwin64\Cygwin-Terminal.ico”, you can add it if it will not show without full path. The last “-” dash in the Target is as it is in default shortcut.
Opening Cygwin64 Terminal will give you Linux like functionality with all the default commands. If you want to navigate away from home, like to “C:\Windows\System32” directory, you can execute:
cd /cygdrive/c/windows/system32
If you want to go to drive “D:”, execute:
cd /cygdrive/d
The latest version of Cygwin support regular Windows locations as well, but with backside slashes as in Linux:
cd c:/windows/system32
As in Linux to show the contents of the directory use “ls” command:
ls