How to Use Linux Commands in Windows with Cygwin

11 Oct, 2021
Cygwin is a collection of tools that provide a Linux Operating System’s terminal look, feel, and some of its basic functionality for users of Windows OS who want to have a go over the basic commands of Linux without worrying about installing a Linux OS.
To use this tool, first of all, we need to download Cygwin setup depending on the version of Windows i.e either 32 bit or 64bit.
Step 1: Launch the Cygwin installation setup and press Next
Step 2: Choose “Install from Internet” and press Next
Step 3: Select the root install directory where you want to install it and choose whether to install it for yourself or for all users and press Next
Step 4: Select a directory where you want to store installation files downloaded by this installation setup and press Next
Step 5: Select the way you want installation setup to connect to the internet and press Next
Step 6: Choose a download site from available download sites and press Next
Step 7: Select packages to install depending upon your needs and press Next
Step 8: Review and Confirm changes
Step 9: Packages will take some time to get downloaded
Step 10: Installation completes and Cygwin is ready to be explored now, press Next
To make Cygwin work in your normal command prompt, we need to add Cygwin to Windows Environment Variables as follow:-
Step 1: In the search bar type “Advanced System Settings” and click on the matching field
Step 2: Click on the Environment Variable button on the bottom right side 
Step 3: Under the system variable tab, select the Path variable and press OK
Step 4: In the installation phase of Cygwin, i.e in Step 3 where the root install directory was chosen for Cygwin installation, go to that location and inside it, copy the location of the bin folder.
copy Location
Step 5: Paste it in the environment variable section which was opened after the completion of Step 3 and press OK
Setting up of Environment variables is completed, we can now run our Linux commands in command prompt
To use Linux commands in Windows with Cygwin, we can now either open Cygwin or command prompt and all we have to do is to type the command into the terminal/prompt and press Enter, as follows :
Example 1: pwd command in command prompt
pwd 
Example 2: ls command in command prompt
ls 
Example 3: echo command in command prompt
echo "your text"
There might come some situation when you want to execute some non-basic commands of Linux in Cygwin whose packages are not installed during the installation process, as follows :
Example 1: nano command in command prompt
nano file_name.txt 
This happens because of the reason that the installed package of Cygwin doesn’t contain the functionality for these commands. To use these commands you have to select packages in the Installation Phase (Step 7) containing the functionality for this command.
Picked
How To
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Set Git Username and Password in GitBash?
How to Install Jupyter Notebook on MacOS?
How to Install and Use NVM on Windows?
How to Install Python Packages for AWS Lambda Layers?
How to Add External JAR File to an IntelliJ IDEA Project?
Sed Command in Linux/Unix with examples
AWK command in Unix/Linux with examples
grep command in Unix/Linux
cut command in Linux with examples
cp command in Linux with examples