How to Use Cygwin
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...
Method 1 of 2:
Installing Cygwin
- Install Cygwin. Go to http://cygwin.com and click on "Install Cygwin" in the left column. This will allow you to download a setup.exe file and choose "Install from Internet." Click "Next."
- Choose your settings. For most users, it is fine to leave the default installation directory, which is "c:cygwin and the other default settings.
- Choose a temporary directory. This is where Cygwin will store the packages you download. Any temporary directory will work.
- 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."
- 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]
- 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.
- 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. - 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 of 2:
Using Cygwin: The Basics
- 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] - 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. - Find text regardless of case. To find text regardless of text, simply add
-i
after thegrep
command. It should look something like this:$ grep -i 'EXAMPLE' EXAMPLE.txt
. - 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] - Explore the basic commands. Some of the basic commands are listed in the table below alongside their corresponding command in Windows. Action Windows Cygwinlist directorydirlsclear consoleclsclearcopy file(s)copycpmove file(s)movemvdelete file(s)delrmcreate directorymdmkdirremove directoryrdrm -rfchange current directorycdcdcurrent directorycd, chdirpwdsearchfindgrepconcatenatecatcatpermissionschmodchmoddisplay/output textechoecho
4.7 ★ | 3 Vote
You should read it
- How to access SSH on Windows 7 using Cygwin
- How to Set Up a Git Server with SSH on Windows
- The Fsutil file in Windows
- How to Compile a C Program
- Ftype command in Windows
- Tail command in Linux
- How to use Isof command on Linux
- The Cat command in Linux
- How to Delete a File Using Command Prompt
- How to change the file's attributes using the Attrib command
- Fsutil command in Windows
- The convert in Windows command