How to run Linux GUI apps with WSL2 on Windows


You can now run Linux graphical apps on Windows with the latest version of Windows Subsystem for Linux (WSL2).



Laptop-with-notebook

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



Links for updating Windows graphics drivers

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.

MAKEUSEO VIDEO OF THE DAY

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



wslg-gvim

To run graphical apps, just like any other Linux system, you can access them from the command line. For example, to 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. In Ubuntu, for example, they are in the “Ubuntu” folder.


Run GUI apps over the network



wslg-ssh

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 -Y Options to activate 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.


run-linux-windows-subsystem

How to run a Linux desktop with the Windows Subsystem for Linux

The Windows subsystem for Linux does not come with a desktop. How to install a WSL desktop environment such as GNOME or LXDE on Windows.

Continue reading


About the author

About Willie Ash

Check Also

Ubuntu Core brings real-time processing to Linux IoT

Most of you are familiar with Ubuntu as a desktop operating system; others know it …