Download ArticleDownload Article

Cygwin is a free command line interface that allows programs that were written for things like Linux and Unix to run on Windows. In other words, it provides an environment where Windows applications and tools can run alongside those from Unix or Linux and, for someone familiar with Unix environments, it can mitigate the need to learn a whole new set of skills to perform simple terminal commands when in a Windows environment. While it may be alien to first time users, the apparently complex nature of Cygwin can become second nature with a little practice.

Method 1
Method 1 of 2:

Installing Cygwin

Download Article
  1. How.com.vn English: Step 1 setup.exe
    Install Cygwin. Go to http://cygwin.com and click on "Install Cygwin" in the left column. This will allow you to download a file and choose "Install from Internet." Click "Next."
  2. How.com.vn English: Step 2 Choose your settings.
    For most users, it is fine to leave the default installation directory, which is "c:\cygwin\ and the other default settings.
  3. How.com.vn English: Step 3 Choose a temporary directory.
    This is where Cygwin will store the packages you download. Any temporary directory will work.
  4. Step 4 Download through a "Direct Connection."
    You will now be presented with a list of Cygwin mirrors. Either select the default, or, if that is running to slowly, choose a random option. Click "Next."
  5. How.com.vn English: Step 5 Choose your software packages.
    You will be presented with a long list of packages that will seem daunting in their scope if you are new to Cygwin. If you are new to Cygwin, stick with the default packages and click "Next." Wait for the loading bar to complete, which may take a few minutes.[1]
  6. How.com.vn English: Step 6 Use Cygwin as you would UNIX.
    It might require a bit of customization. For example, adding your user name to "/etc/password." Make sure you allow it to put an icon on your desktop during setup. When you double-click that icon, it will open up a shell window.
  7. How.com.vn English: Step 7 Wait for the first few lines to appear.
    These will only appear the first time you use Cygwin. After the initial setup phase, you will instead be greeted with yourusername@yourcomputer'sname~ $ in green text. This is where you will input your commands.
  8. How.com.vn English: Step 8 Update Cygwin programs.
    If you would like to update or download more Cygwin compatible programs, simply return to Cygwin's homepage and click "Update." This will take you back to settings options from when you first downloaded Cygwin.
Method 2
Method 2 of 2:

Using Cygwin: The Basics

Download Article
  1. How.com.vn English: Step 1 Find a file.
    Some of the most basic commands you can use in Cygwin are the search and comparison tools. 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.[2]
  2. How.com.vn English: Step 2 Find a keyword within a file.
    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 of 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.
  3. How.com.vn English: Step 3 Find text regardless of case.
    To find text regardless of text, simply add -i after the grep command. It should look something like this: $ grep -i 'EXAMPLE' EXAMPLE.txt.
  4. How.com.vn English: Step 4 Compare two files.
    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.[3]
  5. How.com.vn English: Step 5 Explore the basic commands.
    Some of the basic commands are listed in the table below alongside their corresponding command in Windows.
    ActionWindowsCygwin
    list directorydirls
    clear consoleclsclear
    copy file(s)copycp
    move file(s)movemv
    delete file(s)delrm
    create directorymdmkdir
    remove directoryrdrm -rf
    change current directorycdcd
    current directorycd, chdirpwd
    searchfindgrep
    concatenatecatcat
    permissionschmodchmod
    display/output textechoecho

Community Q&A

Search
Add New Question
  • Question
    How do I launch a program?
    How.com.vn English: 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?
    How.com.vn English: 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?
    How.com.vn English: 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
      Thanks for submitting a tip for review!

      Warnings

      About This Article

      How.com.vn English: How.com.vn Staff
      Co-authored by:
      How.com.vn Staff Writer
      This article was co-authored by How.com.vn Staff. Our trained team of editors and researchers validate articles for accuracy and comprehensiveness. How.com.vn's Content Management Team carefully monitors the work from our editorial staff to ensure that each article is backed by trusted research and meets our high quality standards. This article has been viewed 201,246 times.
      How helpful is this?
      Co-authors: 17
      Updated: February 21, 2024
      Views: 201,246
      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 201,246 times.

      Is this article up to date?