Apps How To Insider Windows 10

Run Linux GUI Apps In Windows 10 Using Bash

Bash – the famous shell used in Linux – was introduced in Windows 10 last week as part of Insider Preview Build 14316, thus allowing you to run Unix commands on Windows. Today, we’ve come across a way to run entire Linux graphical applications in Windows 10 by launching them through Bash. Find out how after the jump.

Linux GUI apps on Windows 10 using bash

Thanks to w2qw for the screenshot

We showed you how to setup Bash in Windows 10 a few days ago. It is one of our more popular posts, and for good reason: developers love the popular Unix shell, and basically just prefer it over Windows’ own PowerShell. The dev community was and is excited to be able to run their favorite Unix commands on their Windows 10 PC.

One developer/redditor named w2qw has discovered an indirect way to run Linux apps on Windows 10 using bash in combination of Xming’s X server. In the screenshot below, you can see Mozilla Firefox, and Vim – GUI apps compiled for Ubuntu Linux – running side-by-side with Windows 10 apps.

It’s an interesting use of bash. Chances are Microsoft didn’t think clever users would be using it like this.

So, how do you run Linux GUI apps on Windows 10? We’ve paraphrased w2qw’s description of it:

After setting up bash in Windows 10, you need to download, install and setup X Server [SourceForge]. Once that’s done, run a command in the following style in bash:

DISPLAY=:0 firefox

w2qw rightly points out this isn’t as fast as running apps natively, since they are running on top of a server, but it is better than using VNC.

The developer community is playing around with this new-found functionality in their PCs. One redditor even managed to run Xfce – a complete desktop environment used in some Linux distributions – on Windows 10. Here’s how it looks:

Xfce running on Windows 10

Thanks to starlig-ht for the screenshot

As someone who hasn’t meddled with the command line or with developer tools for two years since I graduated as a Software Engineering major, I don’t quite understand how it all works. However, I am looking into it and hopefully will find a way to write a better, step-by-step tutorial to guide our readers better.

Until that happens, I recommend you join the discussion over on Reddit, where the community is discussing the implications and applications of this, if any.

 

  • Nicci Niamh Stevens

    The screen shot shows Cygwin, which is hardly new. It’s not the new subsystem for linux. Cygwin will run various desktop environments but these are programs compiled for it. Subsystem for Linux seems to promise using binaries compiled for Ubuntu on windows without recompiling. Either method would require an X server to show the guitar windows.

    • Nick

      http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/ this will be less confusing microsoft partnered with Canonical to make this happen. also that screenshot is not cygwin but xfce running off of ubuntu on windows.. here is a snippet from the article i posted. “Microsoft has worked with Canonical to offer a full Ubuntu-based Bash shell that runs atop this subsystem. Technically, this isn’t Linux at all. Linux is the underlying operating system kernel, and that isn’t available here. Instead, this allows you to run the Bash shell and the exact same binaries you’d normally run on Ubuntu Linux. Free-software purists often argue the average Linux operating system should be called “GNU/Linux” because it’s really a lot of GNU software running on the Linux kernel. The Bash shell you’ll get is really just all those GNU utilities and other software.”

  • Carlos Osuna

    Awais. There’s no magic here, just something created by MIT 30+ years ago.

    Basically X11 is a client server architecture which enables any binary app to share a display, a mouse and a keyboard with hundreds of applications running in different computers. The server just “hears” the displays commands and returns the keyboard and mouse actions via a callback delegate (RPC).

    It’s essentially what you do when you open your YouTube app and “connect” it to a Google Cast compatible system (e.g. Chromecast), although in that case the “client” is actually at the cloud.

    With that in mind, these guys (and gals) are just opening a Windows Native X11 Server and telling the linux binaries running inside the Windows Subsystem for Linux to target their sockets request to it, as pero DISPLAY=(localhost):0.

    The display server needs to be Windows Native since no Ubuntu binary would be able to target the display directly.

    That’s the reason Microsoft has been mum about this, since they can’t offer an X11 server INSIDE ubuntu, that would definitely break, since it can’t release a video driver.

    Alas, this is an amazing feat which reminds me of the late Deskview/X which was the last attempt by Quarterdeck to remain relevant, just like…. well you know whom.

    https://books.google.com.mx/books?id=6z0EAAAAMBAJ&pg=PA15&redir_esc=y&hl=es-419#v=onepage&q&f=false

    • Nicci Niamh Stevens

      Those aren’t linux binaries, they are windows binaries compiled against the Cygwin system. Windows Subsystem for Linux is lacking an number of things including PTY support. Multi-threading is lacking.

      You’re quit correct about the X server. It would, in fact, be rather bizarre for a linux program to have some internal fundamental Windows video code. (tho I can see where, perhaps, a .NET binary might or a script using a standard linux GUI library interface might have hooks into windows but I think that can be called bizzare. )

      I’ve been using Cygwin for years and it gives me a nice bash interface on Windows. No it doesn’t run Linux binaries. Like a lot of Microsoft things they’re doing nothing new and what they are doing, granted its beta, is implemented badly. There have been subsystem-ish linux-ish things for windows for a very long time. They may not have had the tight integration this might bring, but WSL doesn’t have that now either. I have a number of methods of doing Linux-ish things: CygWin, Hyper-V, dedicated VPS, dual-boot The coding I do these days tends to be OS agnostic: PHP, Python, Node-JS and Client Javascript with a deployment target of a Linux Server. Cygwin gives the tools now to code and deploy with zero modification from Windows desktop to Linux server.

      One final note: I can run GUI clients on my VPS (it’s in Quebec, I am near Seattle) over my SSH sessions using a Windows X server.

      • Eric

        Nicci, you seem to be confused. The new Linux Subsystem for Windows allows Windows to run native Linux binaries. This was something I was confused about myself for a while. This is not a Cygwin solution where binaries compiled for windows are run.

      • Arvind Allawadi

        Why multi-threading is lacking, is there a reason why that is not possible. Thanks.

  • Thomas Lake

    Firefox doesn’t work for me. I get:
    root@localhost:~# DISPLAY=:0 firefox
    Sandbox: unexpected multithreading found; this prevents using namespace sandboxing.

    (firefox:12): LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Error sending credentials: Error sending message: Invalid argument

    • Bryan Lennon

      This’ll make DBUS use TCP instead of sockets. WSL doesn’t like sockets, but can do TCP. 🙂 Good luck. Might want to backup this file “just in-case” 😉 sudo sed -i ‘s/.*/tcp:host=localhost,port=0/’ /etc/dbus-1/session.conf

  • Brandon Gingi

    I got XFCE4 to work and all applications are working for me so far. It’s nice integrating windows and Linux.