How to add a GUI to the new bash console in Windows 10

Our MySQL specialist Peter Laursen shares his hands-on experience with the new anniversary update from Microsoft and provides a step to step guide on how to add a GUI to the new bash console in Windows 10.


(update: a new and related blog was published  few days later than this one here)

In this update, released on August 2nd Windows supports the Unix/Linux “bash” shell natively. This is not virtualization and it does not require Cygwin or a similar layer “sitting between” the Unix program and the Windows kernel (or “NT kernel” if you like that term better). The Windows kernel has been modified to understand the “bash” command and quite of lot commands and utilities running in bash exactly like on Unix-type Operating systems. Refer Microsoft’s announcement. Also, the below video (among others) is worth watching.

Video source

It is Canonical that provides the Unix/Linux binaries and the Unix/Linux dialect/flavor is Ubuntu. But still, this is not “Linux”. It is also not “GNU/Linux”. For the simple reason that no Linux kernel is involved at all. It is rather “GNU/Windows” (though Microsoft avoids any reference to GNU). Historically the GNU Operating System was released with GNU’s own kernel. However – when completed – Linus Torvalds’s “Linux” kernel proved superior and replaced the original GNU kernel in the GNU project. Also BSD etc. kernels will support (most of) the GNU subsystem. And now the Windows kernel does too.

But “to some extent” only. It is currently in beta and Microsoft will probably never support all Unix system calls in their kernel. Microsoft’s scope and intention is primarily to “bring bash to Windows”. This may partly be because the Windows “Powershell” introduced with Windows 7 (or was it Vista?) never gained popularity and widespread use. Personally, I also think it is a little awkward to use. But for 10+ years there has been a need for a more powerful Windows console than the traditional “cmd.exe”, what is actually little more than a clone of the 30+ year old DOS command interpreter. So now we have both “Powershell” and “bash” to play with in Windows.

How to get started.

To run bash in Windows 10 just ensure that you have the “anniversary update” installed. Further, you must navigate to Windows 10 settings .. updates and security .. for developers .. and here check the option to define the machine as a “machine for development”. That’s almost all. Now you open a command window and type “bash”. Bash will be downloaded and after a few and simple configuration steps you are ready. This blog elaborates on details(with screenshots).

To see it in action just try to filter the content of your Windows home folder with a regular expression using a typical Unix command “ll | grep Do”. This will list your Windows “Downloads” and “Documents” folders (remember that Unix syntax and file system are case-sensitive).

inline image

The environment installed is very minimal but you can install a lot more things (“sudo apt-get install ..”), that will actually work – including at least:
* Unix scripting languages (Python, Perl, Lua etc.)
* Unix command-line programs (a good example of this is “curl”)
Much of this can be installed on Windows natively, but they were originally designed for a Unix shell and feel more right in this environment.

Launching GUI programs.

Even some GUI programs will work and this is what the rest of blog is about.

I am not a Linux geek but occasionally use several Linux distros for testing our own programs. I am not comfortable with the Linux command line for non-trivial tasks. I prefer a GUI and for the same reason, my preferred Linux distro is SuSE/OpenSuSE (due to the “YaST” GUI available there). But there are few Linux distros I have not tried over the last 10 years – for either curiosity or because I needed to do some testing on the environment.

My three primary GUI requirements are 1) a GUI program launcher 2) a GUI file manager 3) a GUI for software management. With Fedora etc. I will start installing the “Yum Extender” and with Debian/Ubuntu etc. I will install the “synaptic” GUI front-end for the “apt” package manager.

So my first requirement was to run synaptic. It installed with “sudo apt-get install synaptic” without errors. I had already come across this blog that gave an example how to run GUI programs (Firefox in case). What you need to do is basically
1) install an X-server in Windows and ensure that it is running from the system tray. “Xming” is small, has a negligible footprint on your Windows system and does the job.
2) before running a command in bash that requires an X-server for display, run the command “export DISPLAY=:0”. This will forward the output to the X-server sitting and waiting in the Windows system tray.

Now synaptic would not run out of the box from bash. However, it was easy to find a workaround in the Ubuntu Forums – install and use “gksudo”. Synaptic launched in the X-server (with lots of errors in the bash console, though!) and I could install Firefox from Synaptic and next launch Firefox from bash. It connected to the Internet.

Installing a full GUI desktop.

However why not install a full GUI desktop then, I thought? My Linux GUI desktop preference is XFCE. I use it with all Linux ‘flavors’ if possible. So this I would try for a beginning. It installed (“sudo apt-get install xfce4”). However, when launching it (“startxfce”) the X-server complained that communication from XFCE was incorrect. So the two seem to have some problem agreeing about the “handshake” in this environment. However, when I tried the (a little more simple) LXDE desktop, it launched without errors in the console and was pretty functional from the very beginning. I only had to configure the LXDE panel so that it did not hide the Windows taskbar.


I have added some programs that you would normally not run in this environment – both for having fun, but also in order to show that quite a lot of things will work.  In the panel, I have only the program launcher and a clock. You may see the setup in this image. You will see the LXDE desktop with the bash console that started it brought on top. I have started a few more programs. You will also see the Ubuntu file system display in both Windows Explorer and Thunar. For some programs, the quality of the graphics is (only) similar to when running Windows programs in Wine on Linux – ie. not elegant, but usable. Also, note that my Windows LOCALE setting (Danish in case) is inherited/honored.

Issues and imperfections.

The environment is not perfect, but functional. The most important issues I experienced are:

1) It is somewhat sluggish and irresponsive for 5-10 seconds after it has been started.
2) It does not play well with the Windows 10 desktop scaling mechanism.  Oddities increase if scaling goes beyond 150%. So if you have a high-resolution monitor  .. 🙁
3) It can only display full-screen. You may “minimize” it and “maximize” it. In “normalized” state it does not respond to resizing. However, programs running in LXDE may be brought to the Windows desktop from the X-server icon in the taskbar.
4) Not all programs will launch from the launcher (for different reasons probably). Synaptic does not launch from the panel – in this case probably because the environment does not handle the root prompt for GUI programs properly (synaptic needs root privileges). But I can launch it from a terminal from within LXDE (ie. “sudo /usr/sbin/synaptic”) and it works. The Thunar file manager does and it is an OK file manager (and also what I use mostly with XFCE).
5) There is no sound, as far as I can judge. LXDE’s simple music player actually opens .mp3-files and there is visual feedback in the player that it plays, but no sound comes out. Now, even console tools may want to say “beep” or whatever, so I think sound support is a reasonable request/expectation. I don’t know if it can be installed or if there is no support for sound.
6) I can access all volumes on the system and also USB-attached drives. But I cannot access network shares. It seems that SMB is not available. Again I don’t know if it can be installed or not.

For MySQL users.

Finally, let us try to run the ‘MySQL’ CLI/command-line client. I installed from synaptic where I searched “mysql” and picked the MySQL 5.6 client package alone (no MySQL server) for installation. Let us try to run it. Observe that I specified “–host=”.  If not the client here will assume it should connect to ‘localhost’ using a Unix SOCKET.


As you see, it connects to my MariaDB 10.1 server running in Windows. There are situations where it’s preferable to run the MySQL command-line tools in “bash” and not in “cmd”,  so this is nice.


Let us summarize the steps (omitting what I did not manage to get working):

1) Ensure that the Windows 10 “anniversary update” is installed and the machine is configured as a “machine for development”.
2) Install an X-server on Windows and keep it running in the system tray.
3) Install bash. Type “bash” in a command window, accept and go through the few configuration steps.
4) Now you just need to execute the statements below in a command window (approve installation of dependencies listed):

sudo apt-get install lxde
sudo apt-get install synaptic // if you want it
export DISPLAY=:0

.. and LXDE starts and you can configure the desktop, the panel and whatever you want. Next go ahead and install software from Ubuntu’s repository.

Nothing to worry about.

One last tip here: When defining your Windows 10 system as a “machine for development” a new Windows command “lxrun” is added to the system. Execute “lxrun /?” to see the options available. So if you messed up things to a state you cannot repair, you can start from scratch by executing “lxrun /uninstall” and next start all over installing bash again. So there is no risk involved experimenting with this.

What will future bring?

What we see now is only the beginning. How far Microsoft wants to take this, we will have to wait and see and this environment is of course not a replacement for my Linux VMs. But if you just need to fire a “curl” command or similar, it is much faster than bringing up a VM and also it uses much fewer system resources. And with the GUI, I just installed, even I can manage and maintain it.