How to Run Graphical Linux Desktop Applications from Windows 10’s Bash Shell

how-to-run-graphical-linux-desktop-applications-from-windows-10-and-8217;s-bash-shell photo 1

Windows 10’s Bash shell doesn’t officially support graphical Linux desktop applications. Microsoft says this feature is designed only for developers who want to run Linux terminal utilities. But the underlying “Windows Subsystem for Linux” is more powerful than Microsoft lets on.

It is possible to run graphical Linux applications in Windows 10, but bear in mind that it isn’t officially supported. Not every piece of Linux software works, and graphical applications are even more complex and less tested. But these should become more stable over time as Microsoft improves the underlying Windows Subsystem for Linux.

Windows 10’s Bash shell only supports 64-bit binaries, so you can’t install and run 32-bit Linux software.

RELATED ARTICLEShow-to-run-graphical-linux-desktop-applications-from-windows-10-and-8217;s-bash-shell photo 2How to Install and Use the Linux Bash Shell on Windows 10how-to-run-graphical-linux-desktop-applications-from-windows-10-and-8217;s-bash-shell photo 3How to Install Linux Software in Windows 10’s Ubuntu Bash Shell

How This Works

First, let’s run down exactly how this works so you can have some understanding of what we’re doing here.

Windows 10 includes an underlying “Windows Subsystem for Linux” that allows Windows 10 to run Linux software by translating Linux system calls to Windows system calls.

When you run the bash.exe program, it downloads and installs a complete Ubuntu user space image on your computer. This includes the exact same binaries–or applications–that would run on Ubuntu. That “Bash on Ubuntu on Windows” environment works thanks to the underlying Windows Subsystem for Linux.

Microsoft doesn’t want to spend any time working on graphical software, as this feature is intended for command-line developer tools. But the main technical reason that graphical applications aren’t supported is that they require an “X server” to provide that graphical interface. On a typical Linux desktop, that “X server” automatically appears when you boot your computer and it renders the entire desktop and the applications you use.

But try opening a graphical application from Bash on Windows, though, and it will complain that it can’t open a display.

how-to-run-graphical-linux-desktop-applications-from-windows-10-and-8217;s-bash-shell photo 4

There are X server applications you can install on a Windows desktop, however. Typically, these are used to render Linux applications running on other computers–the “X11” protocol is rather old and was designed with the ability run over a network connection.

If you install an X server application on your Windows desktop and change a setting in the Bash shell, applications will send their graphical output to the X server application and they’ll appear on your Windows desktop. Everything should work fine, assuming those applications don’t depend on Linux system calls that the Windows Subsystem for Linux doesn’t yet support.

Step One: Install an X Server

There are several different X servers you could install on Windows, but we recommend Xming. Download it and install it on your Windows 10 PC.

The installation process is simple: You can just accept the default settings. It will then automatically launch and run in your system tray, waiting for you to run graphical programs.

how-to-run-graphical-linux-desktop-applications-from-windows-10-and-8217;s-bash-shell photo 5

Step Two: Install the Program

You can install graphical Linux desktop programs like you can any other program, using the apt-get command in the Ubuntu-based Bash environment. For example, let’s say you’d want to install the graphical, GTK-based vim editor. You’d run the following command in the Bash window:

sudo apt-get install vim-gtk

how-to-run-graphical-linux-desktop-applications-from-windows-10-and-8217;s-bash-shell photo 6

It will go through the installation process in the command line window, just like it does on Ubuntu.

Step Three: Set Your Display Environment Variable

Now, you’ll need to set the “DISPLAY” environment variable to point at the X server running on your Windows 10 PC. If you don’t do this, graphical applications will simply fail to launch.

To do this, run the following command in the Bash environment:

export DISPLAY=:0

This setting only applies to your current Bash session. If you close the window, Bash will forget it. You’ll have to run this command each time you reopen Bash and want to run a graphical application.

how-to-run-graphical-linux-desktop-applications-from-windows-10-and-8217;s-bash-shell photo 7

Step Four: Launch an Application

You can now just launch a graphical application by typing the name of its executable, like you’d type any other command. For example, to launch vim-gtk, you’d run:

gvim

It’s that simple. If the application crashes after launching, the Linux system calls it requires may not be supported by the Windows Subsystem for Linux. There’s not much you can do about this. But give it a shot, and you may find that the apps you need work decently well!

how-to-run-graphical-linux-desktop-applications-from-windows-10-and-8217;s-bash-shell photo 8

You can also combine the third and fourth steps, if you like. Rather than exporting the DISPLAY variable once for an entire Bash shell session, you’d just run a graphical application with the following command:

DISPLAY=:0 command

For example, to launch gvim, you’d run:

DISPLAY=:0 gvim

Remember, this isn’t officially supported, so you may run into errors with more complex applications. A virtual machine is a more reliable solution for running many graphical Linux desktop applications on Windows 10, but this is a neat solution for some of the simpler stuff.

Article How to Run Graphical Linux Desktop Applications from Windows 10’s Bash Shell compiled by Original article here

More stories

Why Is My Battery Estimate Never Accurate?

Laptops, tablets, and phones never seem to know exactly how many hours of power they have left. The estimate may jump from two hours to five hours before dropping back down to one hour. Even worse, the battery may suddenly die without warning.

Why Do Scanners Use PDF as the Default File Format?

Nearly all software has a particular format that it automatically defaults to when creating a new document or file, but occasionally the chosen format does not seem to intuitively make sense. With that in mind, today’s SuperUser Q&A post has the answer to a curious reader’s question.

How to Install and Set Up the Belkin WeMo Light Switch

Belkin has an entire line of smarthome devices that go by the WeMo name, including a smart light switch that you can control from your smartphone, allowing you to turn on and off lights (or anything else connected to that switch) right from your smartphone.

How to Add Your Outlook.com Email Address to Microsoft Outlook

The Microsoft Outlook desktop application supports Outlook.com addresses ending in @outlook.com, @hotmail.com, @live.com, and @msn.com. However, it’s not necessarily obvious how to add them–especially if you’re using two-step verification.

How Pokémon Go’s New “Catch Bonus” System Works

It may not be the riot-gathering game it was at launch, but Pokémon Go continues to receive substantive updates from developer Niantic. Most recently, it introduced a catch bonus, which finally gives purpose to most of those medals you’ve been earning.

What Does “Bricking” a Device Mean?

When someone breaks a device and turns it into an expensive brick, people say they “bricked” it. We’ll cover exactly what causes bricking and why, how you can avoid it, and what to do if you have a bricked device.