How to Run Linux Commands from Windows Cmd Prompt

by Thursday, February 23, 2012 0 comments

We all love to have quite a bit of flexibility with the machines we work on. One such thing I love is to have access to both Windows and Linux on the same system. By this, I do not necessarily mean having both operating systems running on the machine. To experience the charm of Windows on Linux, we may use Wine and similarly, to experience the charm of Linux on Windows we may use a program like Cygwin.
In this article, I will guide you on how to use Linux commands from your Windows command prompt to make you have much more flexibility.

First Things First

In order to make this happen, you need to download and install an interface like Cygwin on your machine. During installation, you will be prompted to enter the root folder. Be careful with your choice, as this becomes your root folder with the Cygwin interface.Before we proceed to the command prompt, you may launch Cygwin and get a feel for it. The interface is shown below.
STEP BY STEP:-- 
(download Cygwin )
1. click on install.
2. then install from internet.
3. click on next.
4.  Click on direct connection.

5. Choose any one of them. and click next..


6. Then click on first. unless instal word dont appear.


7. then wait for some time software automaticaly download and install....... after that completion you can enjoy linux .......... :-)


Integrate Cygwin to the Cmd Prompt

In order to make the command prompt understand Linux commands, we need to port Cygwin to cmd prompt. Navigate to the Cygwin root folder that you had selected during its installation. Go to bin folder and copy the location.
Next, open your System Properties dialog box. Go to My Computer, right click and Properties. Go to the advanced tab and find the Environment variables button under it. Hit this button to find a new dialog box appear. This is where you need to configure Cygwin for the command prompt.Select New to create a new environment variable. Give it a name as “CYGWIN” and value as the bin path for the Cygwin root location.After this, select the variable named “Path” and click Edit. Navigate to the end of the variable value and add a new variable as %CYGWIN% after putting a semi colon (;).You are now done and ready to use your command prompt with all the Linux commands.

Look into the Command Prompt

Launch your command prompt and try doing “Path”. You should see something like the image below with the addition of the Cygwin path. If not, something went wrong, and you need to check if you accomplished all steps properly.If all is fine, you will be able to use Linux commands. Try a few simple one’s out and later you may use it to the full extent. I tried commands like ls -l, cat, pwd and chmod. All seemed to work fine.

Conclusion

This is an awesome and interesting way to make Linux commands available on Windows. If you are a programmer or like to work with Linux, you will definitely love it. Not only does it bring a new set of commands but also increases the features of your cmd prompt. Moreover, it is better than just using the Cygwin interface alone.

Unknown

Network Engg

i am Network Engg in WIPRO