How to run Linux GUI apps with WSL2 on Windows

Windows 11 has many new features, but one is especially welcome for users of the Windows subsystem for Linux or WSL. WSL users can now run Linux graphical apps as well as standard command line utilities. This used to be a feature that was limited to Windows Insider members, but ordinary Windows users can now benefit from this feature as well.

If you’ve just upgraded to Windows 11 and are dying to try this out, read on.

Install graphics driver

In order to run GPU-accelerated Linux GUI apps, you need to install the latest graphics drivers for your hardware. Microsoft has created helpful links to driver software for the three major GPU manufacturers: Intel, AMD, and NVIDIA.

Download: Graphics driver for WSL2

Follow the appropriate link to download your graphics driver installer. If you don’t know what type of video hardware you have, open Device Manager in Control Panel and click Graphics Cards. This should show what type of graphics card you have.

After you’ve downloaded the executable file, run it to install the latest drivers for your system. You may need to restart your computer when it finishes.

Update the WSL version to WSL2

Assuming you already have a working WSL installation, all you need to do is make sure you are using the latest version. To do this, simply run this command in a PowerShell window as an administrator:

wsl --update

To force a restart use this command:

wsl --shutdown

Open WSL again and you can now run Linux graphical apps on Windows.

Running graphical apps

To run graphical apps, just like any other Linux system, you can access them from the command line. To the exampleto run the graphical version of Vim enter this in the shell:

gvim

This will launch Vim in a window. You can also start Linux GUI apps from the Start menu. They will appear in a folder with the name of the distribution you are using. To the example, in Ubuntu they are in the “Ubuntu” folder.

Run GUI apps over the network

The great thing about X11 programs is that they are network transparent, which means they can run on one computer while viewing their output on another computer over a network.

To do this using WSL, establish an SSH connection to a remote server that has X11 forwarding enabled. On the client side, you need the -X or -AND Options to enable X forwarding to your device.

Now you can run Linux GUI apps in Windows

The ability to run Linux GUI apps in Windows is a welcome addition and makes the Windows subsystem for Linux much more user-friendly as you are no longer limited to just text-based apps.

If you want to run not just a single app but an entire Linux desktop on Windows, you can too.

Related Posts