Running graphical Linux apps on Windows with WSL

As you have probably heard by now, Windows now comes with something amazing called WSL - Windows Subsystem for Linux.

WSL allows you to run your favourite CLI tools on a Windows workstation. Install WSL from Windows Store, search for Ubuntu for example. Read more about WSL in here: https://msdn.microsoft.com/en-us/commandline/wsl/about

What WSL does not natively support is running graphical applications, aka. X applications.

Trying will result in: Error: Can't open display.


Luckily there are usually ways to go around official limitations, in this case by installing a 3rd party X server on Windows. One example is VcXsrv which can be downloaded from here: https://sourceforge.net/projects/vcxsrv/

Ensure you have installed/enabled WSL, install VcXsrv and go to your Linux by launching Bash on Ubuntu on Windows. Run the following commands:

 sudo apt install x11-apps
 export DISPLAY=:0

In Fedora you'd use dnf instead of apt, naturally.

Running xeyes should look something like this: