Sunday, 16 August 2015

How To Run Linux Commands on Windows

Are you wondering about how to run Linux commands on Windows? Want the power of Linux terminal but don't want to go away from Windows? Then Cygwin is the way to go!

Cygwin is a collection of tools that provide functionality similar to Linux distributions, right inside your Windows OS. According to their website, it gives you that Linux feeling...on Windows :-)

Though Windows has improved their command line interface by introducing PowerShell, still, experienced Linux users will agree that linux tools are more powerful than PowerShell.

Though not all functions are fully supported, it still allows us to use a whole lot of Linux commands without switching to linux. It's a great way for linux beginners to hone their skills before switching their operating system.

How To Run Linux Commands on Windows



Before installing Cygwin, make sure that you have a working internet connection on your system.

To download Cygwin for 32 bit windows, click here. For 64-bit version, click here.

Run the setup file and follow the instructions:

->Select Install From Internet option and click Next.

->Keep the root installation directory to default value (C:\cygwin64) and click Next.

->The downloaded files will be saved in the Local Package Directory, which can later be used to install on another system. Change it to any other drive than C: and click Next.

->Select Direct Connection and click Next

->Select any mirror from the given list and click on Next.

1

->A list of packages comes up. Keep it as it is and click next.

2

->Make sure that Select required packages check box is selected. Click Next.

3

->The installer will start downloading the required files from internet. Create shortcut on Desktop and click Finish.

And that's it! Open Cygwin64 Terminal Shortcut on your desktop. Now you will be able to run bash commands like ls, pwd, cp, mv, rm etc on your Windows OS! You can even use utilities such as sed, awk, grep and vi. :-)

How to Run Linux Commands on Windows

The default directory is /home/user, which is actually c:\cygwin\home\user. To go to C drive, type cd /cygdrive/c

Use Linux Commands in Windows Command Prompt



To use Linux Commands in your normal Windows Command Prompt, add Cygwin to the Windows Environment Variables. To do so,

->Right Click on This PC. Click on Properties->Advanced System Settings.

->In advanced tab, click on Environment Variables. Under System Variables, select Path and click on Edit.

5

->In the variable value text box, after the given text, type:
;C:\cygwin64\bin

(or wherever your cygwin/bin folder is located.)

->Click OK. Now start your command prompt and Viola! You can type the linux commands inside Windows command prompt!

How to Run Linux Commands on Windows

Comment below for suggestions and queries! :-)

No comments:

Post a Comment