PDF download Download Article
Turn your Windows PC into a Linux-style terminal
PDF download Download Article

Cygwin is a free command line interface that allows you to install Linux software and use Linux commands on Windows without having to install Linux. While Cygwin may be unfamiliar to first-time users, it can become second nature with a little practice. Read on to learn how to install Cygwin, use the terminal, install and update software packages, and run basic Linux commands on Windows.

Using Cygwin: The Basics

Install Cygwin to use Linux software and commands on Windows. The setup wizard installs a terminal app and basic tools, and you can install additional packages like Python or Ruby. Once installed, open "Cygwin64 Terminal" to access the CLI.

Section 1 of 3:

Installation and Setup

PDF download Download Article
    • Go to https://www.cygwin.com and click Install Cygwin in the left column. Click the setup-x86_64.exe link to download the installer to your PC.
    • Once downloaded, double-click the downloaded file and click Next to start the setup wizard. Choose "Install from Internet" and click Next to run the Cygwin installer.
  1. For most users, leaving the default installation directory (c:\cygwin\) and the other default settings is fine. You can also choose to install for All Users here or Just Me.
    • Click Next to continue.
  2. This is where Cygwin will store the packages you download. Any temporary directory will work.
    • Like Linux, you can install software in Cygwin from packages. Instead of using a package manager like Apt or Yum, you'll use the graphical package installer in the setup wizard.
  3. Alternatively, if you use a proxy server to access the internet, enter that information now.
  4. You will now be presented with a list of Cygwin mirrors. You can choose any mirror, as they all contain the same software. If the installation takes too long, you can always return to select another mirror.[1]
  5. Only the software in the "Base" category is installed by default.[2] This includes common Linux tools like the bash shell, coreutils, gzip, tar, and necessary Cygwin libraries. To install other software, such as Python or Ruby, you'll need to select "Install" from its corresponding menu.
    • You can rerun the installer anytime to install and update packages.
  6. This installs Cygwin and all the software you've selected. This process can take a while, depending on what you're installing.
    • Once the installation is complete, you'll be asked if you want to add Cygwin's icons to your desktop and the Start menu. It's usually a good idea to at least add Cygwin to the Start menu so you can find it easily.
Section 2 of 3:

Using Cygwin

PDF download Download Article
  1. To get to the terminal, just click the Cygwin64 Terminal in the Start menu. This opens a basic bash shell and prompt, just like in Linux.
  2. The search and comparison tools are some of the most basic commands you can use in Cygwin. To find a file, you can input the following command: $ find . -name EXAMPLE. This will show you all of your files with that name. However, it is case-sensitive.
  3. If you would like to find certain text within a file, you need to incorporate the "grep" command. Thus, to find all instances of "EXAMPLE," you would need to input $ grep 'EXAMPLE' EXAMPLE.txt. This will provide you with all the instances of the text "EXAMPLE" within the EXAMPLE.txt file. However, this particular command is case-sensitive. To find all instances of "EXAMPLE" regardless of case, continue to the next step.
  4. To find text regardless of case, simply add -i after the grep command. It should look something like this: $ grep -i 'EXAMPLE' EXAMPLE.txt.
  5. If you would like to compare two files, you can easily do so by entering the diff command. Simply input the command followed by the names of the two files you wish to compare: diff EXAMPLE.txt PRACTICE.txt. This will then present you with the two files, one after another.
  6. If you want to update or download more Cygwin-compatible software, just run the installer again (the file you downloaded). If it's been a while since you installed it, you can get the latest version from https://www.cygwin.com/install.html.[3]
    • Run the installer and go through the basic installation steps until you get to the "Select Packages" screen.
    • Search for a package to update or install, then select Install or Reinstall.
    • Complete the installer to install or update your packages.
Section 3 of 3:

Helpful Terminal Commands

PDF download Download Article
  1. Some basic Linux commands you can use in Cygwin are listed in the table below, alongside their corresponding commands in Windows.
    Action Windows Cygwin
    list directory dir ls
    clear console cls clear
    copy file(s) copy cp
    move file(s) move mv
    delete file(s) del rm
    create directory md mkdir
    remove directory rd rm -rf
    change current directory cd cd
    search find grep
    display/output text echo echo

Community Q&A

Search
Add New Question
  • Question
    How do I launch a program?
    Fouzi Bounezef
    Fouzi Bounezef
    Community Answer
    To start a program as an administrator, you must right click the window with the option to run as administrator.
  • Question
    How can I use micro for writing program in Cygwin?
    Arrogance
    Arrogance
    Top Answerer
    The syntax of a program varies by language, so that's not directly possible to answer. As far as micro goes, the only thing you need to know is to press Ctrl and S to save a new file, and Ctrl and Q to exit. Use the "arrow" keys on your keyboard to navigate through a file.
  • Question
    How to save the section of my work in Cygwin and restore it to continue?
    Arrogance
    Arrogance
    Top Answerer
    Cygwin is just an API compatibility layer and environment. An answer to your question is very application-dependent.
See more answers
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit

Video

Tips

Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!

About This Article

Nicole Levine, MFA
Written by:
wikiHow Technology Writer
This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions. This article has been viewed 213,760 times.
How helpful is this?
Co-authors: 18
Updated: August 14, 2024
Views: 213,760
Categories: Linux
Article SummaryX

1. Download the installer from http://cygwin.com.
2. Run the installer.
3. Select software packages to install.
4. Follow the on-screen instructions.
5. Enter Unix commands at the prompt.

Did this summary help you?

Thanks to all authors for creating a page that has been read 213,760 times.

Is this article up to date?