by | | 0 comment(s)

Windows 10 Bash: this little hack lets you run graphical Linux programs on your Windows 10 desktop


Windows 10 Bash: this little hack lets you run graphical Linux programs on your Windows 10 desktop

Long gone are the days of Microsoft bashing Linux. Last year, Microsoft introduced the integration of the bash shell in Windows 10, which is an environment within a Windows 10 subsystem, where to run Ubuntu Linux, as well as other distributions, natively.

According to Microsoft, this features is made for developers who want to test and work with Linux applications in console mode, meaning without a graphical user interface, which is exactly the one restriction imposed on bash right now.

If you try to run Gimp, Blender, or any other Linux programs that require a graphical user interface to work, you will most likely see a “display not found” message, or similar warning, because most GUI’s used by Linux rely on X11 or other graphical user interface servers, which is, for the moment, unsupported by bash under Windows 10.

With that said, there is a trick that we can use to run at least some graphical Linux applications in bash.

A practical example:

Let’s install a commonly used writing program for Linux, called Focus Writer, by typing:

sudo apt install focuswriter

This will trigger a prompt asking for the administrative password, since we are using the command sudo, to get elevated privileges to install programs in bash.

Once the installation is complete, let’s run “focuswriter”, and what happens next is that the following message will display:

QXcbConnection: Could not connect to display
Aborted (core dumped)”

error message in bash Windows 10

As mentioned earlier, running a graphical app in Linux, requires a GUI server, such as X11. Such doesn’t not exist for Windows, but there are alternatives, one of which is Xming, which can be downloaded free of charge, from SourceForge: https://sourceforge.net/projects/xming/

Xming is a server application that interfaces with a Linux shell, and translates requests for a graphical GUI, directly to the host desktop environment. In laymen’s words, is listens for any program that needs a graphical user interface, and provides it, on the Windows 10 desktop, within a Windows 10 application window.

Once we are done downloading and installing Xming, Windows Firewall, or any other firewall installed on your system will alert you that Xming is requesting permissions to connect to a network. This is perfectly normal, as even X11 requires a network connection to function.

connect to display 0 ubuntu Windows 10

At this point, the next step is to enable bash to use Xming, which can be done by typing the following line in bash:

export DISPLAY=:0

This line tells bash, and Linux, that a display is available and where to find it. It’s important to note that the equal sign after DISPLAY is followed by a colon (:), which some may miss when reading this article on smaller devices.

If we try to run “focuswriter” again, the application will open in a Windows 10 container, using its original Linux interface, which is pretty neat!

Focus Writer for Linux, running on Windows 10

While most programs will run without problems with this method, it’s worth noting that some may require other components to work properly, such as hardware acceleration support, and other items that may not be available in Xming, or other GUI server programs.


Ready to shop?

PortableOne has the best deals on Windows 10 Pro laptops, featuring the latest hardware-based security features, and full BitLocker encryption to protect your files from prying eyes.


You must be logged in to post comments.