How to run graphical apps in BASH in Windows 10

Updated: October 17, 2016

Hello hello, I don't know why you say Windows, I say Linux. Until recently, the concept of running Linux on top of Windows was only possible through the graces of virtualization. But now, Windows 10 offers a native implementation of Ubuntu. Rejoice.

We saw this in action recently, and we are all amazed. But one thing that we did not succeed in doing was to run graphical applications. The Ubuntu image comes without the graphical component. You can install the X11 server stuff, but you will not be able to launch it. You need an external X server for your graphical apps. Let's try that.


Setup Xming

Ming is the bad guy from Flash Gordon. Xming is an X Server for Windows, which will allow us to export our display and then run graphical applications. Somewhat like VNC and such, except different. Same same but different. After you have properly configured BASH on Windows 10, the next step is to install this program.

Xming setup

Xming setup, more

Once the program is installed, run it. If you have the Windows firewall enabled, it will prompt you. Makes sense, because Xming needs to run as a server and accept incoming connections. You should allow it for the local (private) addresses only. If you have read my Linux commands & configurations tutorial and my Xephyr review from some time ago, the concepts should become clearer.

Firewall setup

A picture is worth a thousand pixels

All right. Xming should be running - it ought to show in the system tray. Now, we should try running a graphical application, like Firefox or VLC or alike. But you must tell the apps where their display is. This can be done in many ways. The simplest:

DISPLAY=:0 <software>

A plethora of lovely images, here we go! This little gallery also includes a screenshot on how I went about accessing the Windows drive and opening a music file. By default, you will only have your home directory, but if you go up, into the Filesystem tree, you will have the mounts for the Windows drives, available under /mnt. Somewhat like WINE does.

Open music

Xming 1

Xming 2

Xming 3


Not at all. There are various problems associated with this exercise. You will not have any 3D acceleration this way. Your sound card or camera will not work, because the Windows Subsystem for Linux (WSL) is a user-mode implementation only, and you can't access the hardware directly at this stage. Performance will also be an issue.

And there might also be various bugs with the graphical side of things, plus missing dependencies. At first, VLC would not run because I did not have PulseAudio correctly set up. It would actually crash. Then it did run, after I installed several more dependencies, but I had no audio. There were also complains from Firefox on namespace sandboxing, however it was running just fine.

DISPLAY=:0 vlc
VLC media player 2.1.6 Rincewind (revision 2.1.6-0-gea01d28)
[0x1217f08] pulse audio output error: PulseAudio server connection failure: Connection refused
Assertion 'pthread_mutex_unlock(&m->mutex) == 0' failed at pulsecore/mutex-posix.c:108, function pa_mutex_unlock(). Aborting.
Aborted (core dumped)

Sandbox: unexpected multithreading found; this prevents using namespace sandboxing.


Here we go. Another topic mastered. This is fun. Who would have thought. But the concept just opens more and more possibilities, and it's only beta. The full stack might be far more engaging, and if drivers are also somehow sneaked into the equation, users will also be able to enjoy better performance and utilize their hardware fully. For the time being, you can use BASH, and with the help of Xming, also test graphical applications with a decent level of stability, unpromised results, and a somewhat laggy experience.

I find the WSL to be one of the more refreshing features of Windows 10, even if it does not serve any great purpose yet. But if you think about it, this Microsoft operating system brings you closer to the world of Linux than any other Windows release has done before. Quite elegant, I must say. One thing is sure, I will be testing and tweaking this more and more. The notion of flexibility, security and who knows what else beckons me irresistibly. Stay tuned for much more fun.