0

I have been using Cygwin for a while. When I need new packages, I open the setup and select the versions I need the the setup handles the rest. I noticed that the programs are all downloaded to C:\cygwin64\bin

Inside the bin folder there are many .exe executables. This includes diff, find, grep, gzip, vi, vim, whatis, which, who, whoami and many others. What I did was to add C:\cygwin64\bin into the user PATH variable.

Now, I am able to access all the programs mentioned above and more, that are downloaded and used for use via Cygwin also through PowerShell and the Windows Command Prompt. I am confused. Are all those programs supposed to run in Cygwin only or any windows terminal? If I can run those programs without Cygwin bash terminal, then what is the point of having Cygwin in the first place?

7
  • 1
    Cygwin permits you to install Linux programs and compile it as a Windows executable. It handles versions and mirror according what you chose during installation step. Cygwin bundles a full Linux environment with same "skeleton". - For example, you can install and use the ssh daemon of Cygwin and use it to connect to your Windows environment. Cygwin has a drives management in a specific path.
    – hidigoudi
    Commented Mar 26 at 19:51
  • So those programs are compiled to be run on windows, they are the windows version of the linux programs? I had thought that the Cygwin makes it possible to run Linux program on windows without having to recompile them.
    – quantum231
    Commented Mar 26 at 19:56
  • 1
    Yes sorry, it's a mistake in my first comment. It does not recompile them. Programs are already compile to a Windows executable (.exe). I can't edit my first comment anymore.
    – hidigoudi
    Commented Mar 26 at 19:58
  • If you got the exe file of rsync for example and add the binary path to your PATH variable, you will be able to use it as any program without Cygwin installed on your machine.
    – hidigoudi
    Commented Mar 26 at 20:00
  • Installing a program in Linux uses something like apt-get or apt-get install I think. I believe that the file extension of Linux programs is not .exe or is it? Does .exe mean that it is for running on x86 machines?
    – quantum231
    Commented Mar 26 at 21:20

1 Answer 1

2

Cygwin is a collection of Linux tools that are compiled to work on Windows as .exe executables.

This is one description :

Cygwin is a collection of open source tools that allows Unix or Linux applications to be compiled and run on a Microsoft Windows operating system (OS) from within a Linux-like interface. Cygwin offers users a Linux-like experience in a Windows environment. This capability helps developers migrate applications from Unix or Linux to Windows-based systems and makes it easier to support their applications running on the Windows platform.

At the heart of the Cygwin collection of tools is the cygwin1.dll dynamic link library (DLL). The DLL serves as an emulation layer that provides Portable OS Interface, or POSIX, system call functionality. The Cygwin distribution also has a large collection of free tools, including most GNU and many Berkeley Software Distribution tools, along with an X server and a full set of X applications.

In effect, Cygwin is a layer between Linux-origin code and the Windows API. It offers libraries that are modified Linux libraries to use Windows calls, while presenting the familiar Linux syntax. It has a runtime layer, implemented by cygwin1.dll, which is the runtime that does the translating to Windows API.

To emulate a unified Linux environment, this DLL creates a shared memory memory segment that is used by all its tools and their own copies of cygwin1.dll.

Cygwin is not intended to work as a Linux virtual environment such as WSL, but to be a tool for Linux developers to port and test their Linux programs on Windows in a familiar environment.

Cygwin supports both Linux and Windows file-names, which lets its utilities to work on Windows folders and files. Some caution should be used, since there are some differences between Windows and Linux. For example Cygwin Linux tools use a line-feed as the line-end character, while windows uses two characters for that.

All Cygwin tools are .exe programs that run on Windows, and they can be used anywhere that a Windows tool can be used.

References :

4
  • Are all .exe programs supposed to be run-able inside cygwin?
    – quantum231
    Commented Mar 26 at 21:22
  • 1
    You could try it, but I don't see any reason that it won't work.
    – harrymc
    Commented Mar 26 at 21:47
  • What is extension of programs that run in Linux e.g if I had FireFox browser in Linux, what would be its extension?
    – quantum231
    Commented Mar 26 at 21:48
  • They are Windows programs, linked as .exe. See cygwin.com/cygwin-ug-net/programming.html and especially the makefile at the end.
    – harrymc
    Commented Mar 26 at 22:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .