How To: Use Cygwin to Run Linux Apps on Windows

Use Cygwin to Run Linux Apps on Windows

You'll see a lot of Linux action going down here at Null Byte. We use Linux for hacking-related stuff because it provides a more relaxed programming environment, making it easy to write exploits and tools. Linux has many features Windows is lacking, such as full control over the OS right down to the Kernel and massive availability of mature, open source (read: free & tweakable) tools & projects.

So Windows users might be wondering, "How do I use Linux applications & commands on Windows?", whether it be because you don't want to install a Virtual Machine, or simply because you don't know how to use Linux.

Cygnus Solution has a tool that can remedy this issue, called Cygwin. Cygwin uses its own DLL (Dynamic Link Library), which acts as a Linux API. It does not emulate Linux. It is a compatibility-layer (Linux-users, think Wine). You have to compile all of the Linux apps from source, no pre-compiled packages.

In this Null Byte, I'm going to show you how to install, and run a demonstration program in Cygwin.

Step 1 Download and Install Cygwin

  • Download Cygwin from the official website.
  • Double-click the setup.exe file from where you saved it (likely, Downloads).
  • Click on "Install from Internet".

How to Use Cygwin to Run Linux Apps on Windows

  • Install Cygwin for your user only, unless you plan on everyone using it.
  • Hit "Next" until you get to the part with the mirror selection (this selects what server you wish to download Cygwin packages from).
  • For the sake of things working the same, you can use my mirror, as in this image below, but the choice probably doesn't matter.
  • Wait for install to complete.

What Packages Do I Pick?

You should be at the package installation screen now. If you look at the word "All" at the top, to the right of it you will see "Default".  By clicking on that you will see: "Default", "Update", "Install", and "Uninstall". The setup.exe acts not only as an installer for Cygwin, but a package manager and updater as well. With this, you can control all of Cygwin, and its install software. If you don't want anything in these packages, just install the "Default" method- it only installs the minimum packages to allow Cygwin to run.

How to Use Cygwin to Run Linux Apps on Windows

Simply hit "Next >" a few more times to install the base-packages.

By now you should be all installed and ready to go. Just navigate through the Start-menu to find Cygwin and run it.

Step 2 Using Cygwin and Installing Packages

Now, I'm going to go over how to use a few basic commands, and install a package from source in Cygwin.

You can navigate the terminal, just as you would in Linux. You have access to "cd" "cat" "gcc" and all of the other commands, just like a normal Linux rig.

To get a feel for the terminal, I'm going to just install Eggdrop, an IRC bot, to show you how a normal install goes. Linux uses different compression archives than Windows (.zip, .7z, .rar).

Installation

  • Download Eggdrop source code (tar.gz).
  • Move the source into C:\cygwin\home\Owner.

How to Use Cygwin to Run Linux Apps on Windows

  • Switch back to your Cygwin terminal and type "ls". You should see your package listed as a sub file/directory.
  • To extract the package type:

        tar -zxvf eggdrop1.6.20.tar.gz

  • After the text is done scrolling, change to the Eggdrop directory with this command:

       cd eggdrop1.6.20/

  • Now we have to "compile" the code into code the computer can understand (binary executable): 

      ./configure && make && make install

  • Now the program should be installed and run-able!

      eggdrop

Now you shouldn't feel left out when it comes to Linux applications, because you can run them, too. I hope this was an informative Null Byte. Come visit the Forums and chat!

Just updated your iPhone? You'll find new emoji, enhanced security, podcast transcripts, Apple Cash virtual numbers, and other useful features. There are even new additions hidden within Safari. Find out what's new and changed on your iPhone with the iOS 17.4 update.

23 Comments

How bout running Windows apps on Linux? I've tried Wine but it doesn't work...

Wine does work, but it's hard to config. I recommend just using a Windows XP VM. It works the same, has a smaller isntall than Wine, and runs everything perfectly :)

What apps would you like to run? Most of the time, Linux has better (free) alternatives.

Well, a lot of online games require an app and different things, anything I want thats only for Windows / Mac.

Yes, a Virtual Machine would work fine for that.

Which I do want to do

Ok, say I want to install Steam. How do I do it?

unfortunately the best way for that is virtual machines

Oracle's Virtual Box. It's in every Linux distros package library/db. It's the same as a normal computer, it's literally Windows running inside of Linux. So installing Steam would be the same as normal :).

So if you're on Ubuntu.
sudo apt-get install virtualbox

oh thats cool (:

Can I have the link?

http://www.virtualbox.org/wiki/Downloads

thanks

Had installed cygwin as a requirement for etext editor. More than that I liked the terminal on osx and linux.

But for some reason 'ls' returned nothing. Any suggestions to make it work ?

"ls" is a core binary file...it is always included. I'm not sure why it wouldn't be in there. Literally nothing happens when you enter it in the terminal? Because there might be nothing in whatever directory you are in. Try "ls -a" and that will list hidden files as well. If you see "." and ".." files, "ls" is working properly.

Thanks for the info. May be its time for my windows spring clean and reinstall. phew!

ls in my case returned just an empty line and back to the prompt.

Haha, I remember those! Back when I used Windows, every night I would defrag and clean temporary files. Then every 3 months was a Reinstall! Now, with Linux, I barely do anything, and I have a custom disc I made with all of my software on it already, so a reinstall isn't a hassle anymore!

I love Linux :)

I get this error:

This is Eggdrop's GNU configure script.
It's going to run a bunch of tests to hopefully make your compile
work without much twiddling.

checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home/student/eggdrop1.6.20':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
I thought the C compiler would be installed with cygwin. Any ideas?

@incognito wolf

Turns out this comes from not having a program capable of making the file. Try running setup.exe again and telling it to download gcc. If that doesn't work, modify your system path by going to the windows environment variable settings (just search for "path" in the start menu) and adding a new path called gcc with the path to gcc.exe

@alex long
im having same problem as above.....
im new.....plzz help

im trying to install just default packages but after when i go to run cygwin its asking for me to locate mintty? wtf?

No compiler found error. what should do?

i'm also getting same error what to do

Share Your Thoughts

  • Hot
  • Latest