Running linux command on windows

4 Ways to Run Linux Commands and Software on Windows

So, all the times we have written about platform applications for another platform, it was with regards to the availability of Windows software for the Linux platform.

What if you want to run Linux software on Windows? Afterall, there are certain features that are peculiar to Linux and sometimes, Unix-like platforms.

There are several ways to work with Linux software (including software and commands) within a Windows environment and today we will go through the most reliable ways.

1. Virtual Machines

This is the quickest and most reliable way to run Linux software on Windows because you will be running the complete OS within your Windows installation with access to everything that you have to offer. Your only limitation will be your machine’s hardware.

There are a handful of efficient virtual machine software that you can try with the most common and free solution being VirtualBox.

2. coLinux

coLinux stands for Cooperative Linux and it is a program that enables you to natively run Linux on Windows and other Operating Systems.

It is a port of the Linux kernel and its code allows it to run alongside another OS without the need for emulation.

3. Windows Subsystem for Linux and Bash

Microsoft collaborated with Canonical in 2016 to provide a reliable version of Bash for Windows. It is capable of running our favourite Linux commands and tools like nano, grep, and ssh.

What’s even cooler is that Bash on Windows can be activated easily.

4. Remote Access

You probably didn’t see this point coming because it isn’t exactly running Linux software on Windows, but imagine that you already have a Linux machine that you can plug into, perform your tasks, and move on. Remotely accessing desktops has been a tech skill for almost as long as cool networking options have existed.

The most common methods include Virtual Network Computing (VNC), Remote Desktop Protocol (RDP), and of course, Secure Shell (SSH).

RDP ships with Windows 10 but you will need to install xrdp on the Linux machines you will be remotely accessing. VNC requires a number of dependencies and SSH is a command-line tool you can use with an app like PuTTY or KiTTY.

So, assuming there aren’t cross-platform software versions of Linux apps for you to use, you can always try any of the above methods.

The more you work with any if not all of the listed options, the more experience you gather and you will know which one works best for you and you’ll be able to share your experience with us.

Are there any methods of running Linux software and tools on Windows that I have left out? Tell me about them in the comments section below.

Читайте также:  Сетевое администрирование linux стахнов

Divine Okoi is a cybersecurity postgrad with a passion for the open-source community. With 700+ articles covering different topics in IT, you can always trust him to inform you about the coolest tech.

Each tutorial at GeeksMint is created by a team of experienced writers so that it meets our high-quality writing standards.

7 thoughts on “4 Ways to Run Linux Commands and Software on Windows”

Recently, I actually put a new Windows system together. That in and of itself is not unusual, but this system is for me. The Windows Subsystem for Linux and Bash had me so curious that I got an Ebay laptop with good specs for running Windows 10 and went to work. The first thing I learned is that you can still get the free upgrade to 10. I own a legal copy of Windows 7 Pro and Microsoft allowed me to cash in on the free upgrade. (for the third time, I might add) Even better, I have Windows 7 installed right next to 10 and everything is activated. I thought the free upgrade ended a couple years ago. What’s more, it’s easier now than when it was first introduced and it allows for a ton of options. You can even get an upgrade to Pro or Ultimate for a significant discount, depending. The second, is that Microsoft has refined Windows 10 quite a bit since I walked away from Windows almost four years ago. They allow removal or disabling of much more now than they did but it doesn’t go far enough. I despise bloat and there remains plenty. Not as much as OEM versions but enough. After using Linux exclusively during that time I became somewhat spoiled because Windows feels sluggish, in comparison. My workstation system runs openSuSE Krypton. Plasma matches Windows 10 in features and eye candy. My openSuSE rig has the same i7 processor but only 8 gigs of RAM compared to 16 for Windows 10. Plasma smokes, Windows 10 doesn’t. I will do some optimizing on Windows and it will help but it isn’t going to touch Plasma, or any of my Linux boxes and it never will. Windows is just a resource hog and that is all there is to that. While, I have not yet had the chance to fully explore these new capabilities Windows now has, what I have seen is pretty alright. My belief in Microsoft’s sincerity in embracing Linux is a little stronger. The Powershell would have been great back when I was in IT. Much more powerful than the standard command prompt. I am still somewhat skeptical but Microsoft’s recent move to open source 60,000 patents went a long way to quell some of that skepticism. They will take a major financial hit as a result of that move and in doing so they are helping to protect Linux from potential lawsuits. The move was both friendly and seriously cool, as well as one that developers working on Linux and Android platforms surely welcome. I was not aware Microsoft had so many patents involving Linux. The Linux friendly additions to Windows are rather significant and there are more on the way. I am both surprised and encouraged by what I am seeing and it may well lead to some cool possibilities. Cross-platform interoperability is one. Lots of potential going on. I still do not see a return to significant Windows use, for my part but I will be checking out these new features. Windows 10 is impressive in some ways. I say that because I am still a computer geek and I love tech. Windows 10 is the most Linux like because of its scalability, if nothing else. Like Linux it can tailored to work on just about anything. I look forward to what may come. Linux becomes more impressive as does FOSS. So many open source applications now rival or surpass proprietary developments that it blows me away. Yet, Wallapatta still does not have a Linux version! What’s up with that, Martins? Well, I can run it on my new Windows box until they do! Another excellent article. Reply

Читайте также:  От чего имени запущен процесс linux

Wow! If I may ask, do you work with computers for a living or are your computing skills a result of your passion (and maybe hobby) alone? Reply

Hi, consider adding http://cmder.net/ + Chocolatey packages (e.g. Open SSH). I can use majority of Linux commands in Cmder without WSL easily. SSH, nano, curl, wget, find….literally almost everything. Reply

Not to steal the thunder of @ Amaro Vita (see first comment), whose comment is outstanding–AND absolutely the best solution– but an amplification/suggestion… Anyone running Linux is, at minimum, somewhat ahead of the technical-competence curve, even if they run Windows almost exclusively.
Dual-booting a Linux distribution these days is simpler than using almost any other solution needed to ‘get’ Linux and Windows on the same machine. Then one has a ‘real’ Linux OS, with never a worry about ‘virtual’ hardware or software.
Most Linux distros worth their salt offer a dual-boot option at installation, Check it out. The last time I did this it took all of twenty minutes to install Linux Mint 18.2 alongside Windows 7 (and please, Windows fanboys: no comments as to my choice of Windows. Stay focused.).
I now have two excellent OSs, and I never worry about things possibly not working because of not being run “natively’. Reply

Источник

How to call Linux commands through WSL in Windows command line?

I would like to use ls , and many other Linux tools, from the command line on Windows 10. I know that there is GnuWin32 and other binary replacements, but none of those works as elegantly as the Windows Subsystem for Linux (WSL); including the update mechanisms. With WSL, one can call ls . from the command line via bash -c «ls . » , which works great. Ideally, however, I would just type ls on the command line. I can create an ls.bat which basically does @bash -c «ls %*» — but I would have to do that for every single command I want to export. Is there a more direct way of exporting ls (and many others) to the command line?

Читайте также:  System programing in linux

The bash commands available in WSL are not intended for use outside of WSL. I would be surprised if that is ever implemented.

@ifconfig Well, it doesn’t have be intended or implemented. I would be happy with a one-liner aliasing «many» well-known Linux commands to the respective WSL commands.

4 Answers 4

Apparently this was the most requested feature for WSL, and Microsoft now supports this feature. To use linux commands from within Command Prompt (or PowerShell), just prefix the command with wsl . So, for example, here’s how you run ls from CMD.

Or here’s how you update package lists.

C:\temp> wsl sudo apt-get update [sudo] password for username: Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB] 

More details can be found in the official docs. I’m not sure if you are looking for a solution which doesn’t involve any kind of prefixing. If that’s the case, I don’t know of any solution yet.

Microsoft doesn’t directly support what you’re asking for, however.

  • You can create a «Console Alias» using doskey.exe, but these Console Aliases are not persistent (when you open a new Command Prompt window they’re all gone).
  • CMD /? informs us of the following two Registry keys: HKey_Local_Machine\Software\Microsoft\Command Processor\AutoRun and HKey_Current_User\Software\Microsoft\Command Processor\AutoRun , which (as long as the /D option wasn’t specified) will both be checked for contents to run (in that order) when a new Command Prompt window is opened.

If we put these two things together with a FOR loop, and a nice, easily customizable file in your user folder, we can get a pretty close approximation of what I think you want.
I’m going to put this in HKLM, and reference a file in %USERPROFILE% , called exportlinuxcommands , so that it’s available to all users, but easily customizable on a per-user basis, as well as only functional for users who set it up. If you only want it for one user, or don’t want it to be customizable on a per-user basis, you’ll have to modify the instructions a bit.

  1. Open the Registry Editor
  2. Go to HKey_Local_Machine\Software\Microsoft\Command Processor
  3. Right-click on an empty portion of the window, and choose «New» > «String Value» (or «Expandable String Value», but the expansions seem a little pointless when you realize that the Command Processor will expand them after it reads the value anyway.)
  4. Name it «AutoRun» (without the quotes)
  5. Double-click on the new value you just created
  6. Enter IF EXIST %USERPROFILE%\exportlinuxcommands FOR /F %i in (%USERPROFILE%\exportlinuxcommands) DO @doskey %i=bash -c «%i $*» as the «Value data».

Now you just need to make a file in your %USERPROFILE% folder (i.e. C:\Users\YourUserName ) called exportlinuxcommands , with each Linux command you want an alias to on a separate line. For example:

Want to remove one? Remove it from the file, and it won’t be there in the next Command Prompt window you open.
Want to add another later? Just add it to the file on it’s own line, and the next time you open up a Command Prompt window, it’ll be there.

Источник

Оцените статью
Adblock
detector