Here we can see, “How to Run Graphical Linux Desktop Applications from Windows 10’s Bash Shell”
The Bash shell in Windows 10 does not allow graphical Linux desktop applications. This capability, according to Microsoft, is only for developers who want to use Linux terminal utilities. However, Microsoft conceals that the underlying “Windows Subsystem for Linux” is far more powerful than it appears.
Although it is feasible to run graphical Linux programs in Windows 10, it is not officially supported. Not all Linux software works, and graphical applications are even more complicated and less thoroughly tested. However, if Microsoft improves the underlying Windows Subsystem for Linux, these should become more stable over time.
Because the Bash shell on Windows 10 only supports 64-bit binaries, you won’t be able to install or operate 32-bit Linux software.
How Does It Work?
- First, let’s go over the mechanics of how this works so you can comprehend what we’re doing.
- Windows 10 features an underlying “Windows Subsystem for Linux” that translates Linux system calls to Windows system calls, allowing Windows 10 to execute Linux software.
- When you install a Linux distribution like Ubuntu on your computer, it downloads a complete Ubuntu user space image. The identical binaries–or applications–that would run on Ubuntu are included. The underlying Windows Subsystem for Linux makes the “Bash on Ubuntu on Windows” environment possible.
- Because this capability is designed for command-line developer tools, Microsoft does not want to spend any time working on graphical software. However, the fundamental technical reason is that graphical applications require an “X server” to offer the graphical interface.
- On a normal Linux desktop, the “X server” displays instantly when you boot your computer and renders the full desktop as well as any applications you’re using.
- However, if you try to run a graphical application from Bash on Windows, it would complain about not opening a display.
- However, you may install X server programs on a Windows desktop. These are typically used to render Linux applications running on other computers–the “X11” protocol is old and was meant to run over a network connection.
Applications will send their graphical output to the X server program and appear on your Windows desktop if you install an X server application on your Windows desktop and modify a configuration in the Bash shell. Everything should work OK as long as the apps don’t rely on Linux system calls that the Windows Subsystem for Linux doesn’t support currently.
Step 1: Install an X Server
- On Windows, you can install several other X servers, but we recommend Xming. It is available for download and installation on your Windows 10 computer.
- The installation procedure is straightforward: Accept the default options if you like. It will then launch and run on your system tray, ready to run graphical apps when you do.
Step 2: Install the Program
Using the apt-get command in the Ubuntu-based Bash environment, you can install graphical Linux desktop programs just like any other package. Let’s imagine you wish to install the graphical vim editor, which is based on GTK. In the Bash window, type the following command:
sudo apt-get install vim-gtk
It will walk you through the installation procedure in a command-line window, much like Ubuntu does.
Step 3: Set Your Display Environment Variable
- Set the “DISPLAY” environment variable to point to the X server operating on your Windows 10 PC now. Graphical apps will not start if you don’t do this.
- Run the following command in the Bash environment to accomplish this:
This option is only valid for the current Bash session. Bash will forget about it if you shut the window. This command must be executed every time you reopen Bash and want to use a graphical application.
Step 4: Launch an Application
- You can now input the name of a graphical application’s executable like any other command to start it. To start vim-gtk, for example, type:
- That’s all there is to it. If the application breaks after launching, it’s possible that the Windows Subsystem for Linux doesn’t support the Linux system calls it requires. You won’t be able to do much about it. But give it a chance; you could discover that the programs you require operate reasonably well!
- If you like, you can combine the third and fourth phases. You could just run a graphical application with the following command instead of exporting the DISPLAY variable once for an entire Bash shell session:
For example, to launch vim, you’d run:
Remember that this isn’t officially supported, so that you might run into issues with more complicated apps. Although running many graphical Linux desktop programs on Windows 10 in a virtual machine is a more stable alternative, this is a nice solution for some basic tasks.
I hope you found this information helpful. Please fill out the form below if you have any queries or comments.
- Can WSL2 execute graphical user interface (GUI) applications?
Windows Subsystem for Linux (WSL) support for running Linux GUI apps (X11 and Wayland) on Windows in a fully integrated desktop experience is now available for testing. WSL 2 makes Linux graphical user interfaces feel native and natural on Windows.
- How do I use WSL to run a GUI?
If you want to use Linux GUI app support, make sure you’re using Windows 10 Insiders preview version 21364 or higher. If you already have WSL installed, you have to run will —update to enable GUI programs.
- How do I run a graphical user interface in Linux?
- Install the GNOME desktop environment if you haven’t already.
- (Optional) Allow the GUI to load after a reboot.
- Using the systemctl command, you can start the GUI on RHEL 8 / CentOS 8 without rebooting: # systemctl isolate graphical.
- FYI, you can use Bash to execute GUI Linux programs.
- Introducing Linux GUI apps running on Windows using the Windows Subsystem for Linux (WSL)