How to Run Linux GUI Applications with WSL2 on Windows
This used to be a limited feature for Windows Insider members, but regular Windows users can now take advantage of the feature as well.
If you have just upgraded to Windows 11 and want to try this feature, continue reading the following article.
Install the graphics driver
Microsoft provides driver software for 3 major GPU manufacturers: Intel, AMD and NVIDIA
To be able to run GPU-accelerated Linux GUI applications, you will have to install the latest video drivers for the hardware. Microsoft has helpfully created links to driver software for the three major GPU manufacturers: Intel, AMD, and NVIDIA.
Click on the appropriate link to download the graphics driver installation program. If you don't know what type of video hardware you have, open Device Manager from Control Panel and click Display adapters. This will show what type of video card you have.
Once you have downloaded the executable, run it to install the latest driver for the system. You may have to restart your computer when the process is complete.
Update WSL version to WSL2
Assuming you already have a working WSL installation, you just need to make sure you're using the latest version. To do that, just run this command in a PowerShell window with admin rights:
wsl --update
To force restart, use the following command:
wsl --shutdown
Open WSL again and you should now be ready to run graphical Linux applications on Windows.
Run graphical application
To run graphical applications, you can call them from the command line as you would on any other Linux system. For example, to run the graphical version of Vim, you must enter the shell:
gvim
This will launch Vim in a window. You can also launch Linux GUI applications from the Start menu. They will appear in a folder with the name of the distribution you are using. For example, with Ubuntu they will be in the "Ubuntu" folder.
Run GUI applications over the network
The great thing about X11 programs is that they can run on one machine while displaying the output on another machine over the network.
To do this with WSL, go through the process using SSH to log into a remote server with X11 forwarding enabled. On the client side, you'll need to use the -X or -Y options to enable X forwarding to your machine.
Now you can run Linux GUI applications in Windows
The ability to run Linux GUI applications in Windows is a welcome addition and makes the Windows Subsystem for Linux much more useful, as you are no longer limited to only text-based applications.
If you don't just want to run a single application but run the entire Linux desktop on Windows, you can do that too.
You should read it
- How to mount a Linux file system using WSL2 on Windows 10
- Microsoft will release Linux 'genuine' Linux kernel with Windows 10 WSL
- WSL2 now supports connecting Localhost from Windows 10 applications
- Run Windows applications on Linux, macOS and other platforms
- Microsoft released Windows Terminal 1.0, announcing support for the GPU and Linux GUI application in WSL
- How to use Zsh (or other Shells) on Windows 10?
- How are Linux kernel updates distributed on Windows Update?
- Linux GUI applications can run on Windows 10
- Convert data, applications from Windows to Linux in minutes
- How to convert a web application to a desktop application on Peppermint Linux
- The best free music production application on Linux
- How to run Windows applications on Linux with Vineyard