The ability to run graphical Linux apps using the Windows Subsystem for Linux version 2 is one of the most exciting new features in Windows 11, and it’s something that all Linux fans will love. I like how I can run Linux commands on Windows without installing a virtual machine or dual boot while utilizing Windows Subsystem for Linux (WSL).
WSL can be enabled on all major versions of Windows 11. Thus, you don’t need to upgrade from Windows 11 Home to Pro to use it. WSL 2.0, an improved version of WSL designed to run an entire Linux kernel in a Hyper-V environment, is used in Windows 11.
You’ll be able to access the Linux shell from the new Windows terminal after WSL is installed. You may then use commands to install and run Linux applications alongside Windows programs. Windows 11 now supports Linux apps that require GPU access, making it a valuable tool for various users.
This article aims to ensure that you are in a position to comfortably run Linux commands directly from Windows by the end of this article.
What exactly is WSL (Windows Subsystem for Linux)?
WSL is a virtualization solution that allows you to run the Linux kernel and binary executables on Windows inside a lightweight virtual machine for a fully integrated desktop experience.
Microsoft first introduced WSL in 2016, and the company has been working to improve it ever since. WSL 2, the most recent major release, is accessible by default to users of Windows 11 Build 22000 or higher, and it includes support for both command-line and graphical user interface (GUI) apps (X11 and Wayland).
The WSLg System Distro, a Linux container running the Weston compositor, XWayland, and the PulseAudio server—all packaged and delivered in the Virtual Hard Disk format—enables the operation of GUI programs. The System Distro, unlike the User Distro, which can be any of various Linux distributions (Ubuntu, Debian, CentOS, and others), is mounted read-only, and any changes made to it are deleted when WSL is restarted to allow seamless upgrading.
The native mstsc.exe RDP client, which talks with FreeRDP in WSLg, is used by the Windows operating system to render GUI applications running in the WSL virtual machine. Linux programs are incorporated into the Windows Start menu thanks to an RDP client plugin, allowing users to launch them with a single click.
WSL 2 provides a fully integrated desktop environment that allows you to:
- Linux software can be pinned to the Windows taskbar.
- From the Windows Start menu, launch Linux applications.
- To switch between Linux and Windows apps, use the alt-tab.
- Cut and paste across programs on Windows and Linux
WSL is accessible on Windows 10 as well. However, Windows 11 systems have more outstanding features. This guide will show you how to use the Windows Subsystem for Linux to execute Linux GUI apps (WSL).
On Windows, an example of Linux commands
echo "Windows Subsystem for Linux"
I recommend upgrading to Windows 11 to get WSL to work correctly. WSL is also compatible with Windows 10, but in my experience, Windows 11 is far more efficient. You’ll need Windows 10 build 21364 or above to use it. This post will go through what you can accomplish on both Windows 10 and Windows 11 in this article.
How to set up WSL on Windows
WSL installation has been dramatically simplified with the release of Windows 11, and it now only requires executing a single command in Windows Terminal:
- Select Windows Terminal by pressing Win + X. (Admin).
- Press Enter after typing the following command: wsl –install
- Wait until you’ve downloaded all WSL components and the default Linux distribution (Ubuntu).
Alternatively, the Command Prompt or PowerShell are the other options to install WSL on Windows 11. Depending on which setting you want, you can perform this with either tool. Go to the Start menu (or hit the Windows key) and input cmd or PowerShell to launch a new PowerShell window. Select Run as administrator on the right after hovering over the best match outcome. If the UAC prompt comes, confirm that you want to execute your chosen software.
WSL can be started with the following command:
If you’d prefer to install a different Linux distribution, type the following command to declare your preference:
wsl --install -d <DistributionName>
This command will return a complete list of all available distributions:
wsl --list --online
wsl -l -o
The Linux kernel will be downloaded, WSL 2 will be set as the default, and Ubuntu will be installed as the default distribution.
Currently, the following distributions are available:
- Leap 42 is the latest version of OpenSUSE.
- SUSE Linux Enterprise Server 12 is a server that runs SUSE Linux Enterprise (SLES)
- Kali Linux is a Linux distribution that focuses on security
- Debian GNU/Linux is a free and open-source operating system.
You will be prompted to restart your computer after the installation is complete. After you log back into Windows, a terminal window will open immediately to complete the Ubuntu (or whichever distribution you’ve chosen) installation. After that, Ubuntu will ask you for a username and password.
How to update WSL installation already in place
If you already have WSL on your computer, you can use an elevated command prompt to update to the newest version, including Linux GUI support. Click on the start menu, type PowerShell, right-click Windows PowerShell, and select Run as administrator from the menu.
To use the WSL update command, type:
For the upgrade to take effect, you must restart WSL. The shutdown command in PowerShell can be used to restart WSL.
Install Graphics Drivers for WSL
When running GPU-accelerated Linux GUI apps on your machine, graphic drivers are critical. Install the newest graphics card driver with WLS support before installing and running your first Linux GUI application to enable GPU acceleration. Below are the three major architectures.
Note that installing this Intel generic graphics driver will overwrite the customized driver installed by your computer manufacturer (OEM). OEM drivers are hand-picked and contain unique features and platform-specific solutions. The generic Intel driver offers users the most up-to-date feature updates and bug fixes that OEMs may not have yet adapted to fit platform-specific requirements. On OEM websites, users can look for compatible OEM versions.
You may now run Windows Terminal and change the default shell to Ubuntu by picking the Ubuntu option from the down-arrow icon at the top. You should see a familiar Ubuntu Bash prompt at this point.
The initial greeting message includes helpful system information, such as the virtual machine’s IP address. After that, on your start menu, you’ll see an app called Ubuntu (or any other distro):
Opening the Linux Terminal
You’ll be presented with a Linux terminal when you open the Ubuntu program you just installed! Try the following commands:
What happens if I need to go to my Windows files?
When you open your file explorer (winkey+E), you’ll notice a new Linux option on the left that contains all of your Linux files. That is where you’ll find any files you create in the terminal:
But what if you need to get to your files?
Fortunately, you can do so quickly. Simply type the following into your Linux terminal:
You can find your computer drives by typing ls here. You’ll be able to cd into your system files this way.
How do you make aliases In WSL2?
Do you ever have to write a long command and wish there was a shortcut? Then aliases will be your best friends. Aliases can be created in two ways:
- per session
How do you make aliases for each session In WSL2?
You should perform the following command to create an alias in your current Linux session (the alias will be forgotten once you quit the terminal):
alias <alias name>='<command>'
as an example:
alias runc='gcc main.c -o main'
How do you make permanent aliases In WSL2?
To preserve our aliases, we’ll update a file called .bash_aliases. Execute these commands:
cd ~ ls -a
Look for .bash_aliases in the list of files that have been printed out. If you’re having trouble finding it, use the following command:
Use the following command to edit the file:
You’ll be welcomed by a screen that looks something like this:
To begin typing, press I and add as many aliases as possible. Consider the following scenario:
alias runc='gcc main.c -o main' alias hello='echo windowspixel'
Press “Ctrl + c” to quit typing mode.
Type “:wq!” to exit Vim and save the files.
You’re all set! Start typing any of the aliases above after restarting Ubuntu, and it should function perfectly:
How to run graphical user interface apps
Okay, now we know how to use WSL2 to launch command-line apps. But what if we want to use Linux’s graphical user interface? The answer is straightforward: you must first install the GUI application before executing it. After that, you can install any package from the official Ubuntu repositories. As an example, I’ll use Firefox.
WSL’s GUI app support does not give a complete desktop experience. It’s possible that installing desktop-oriented tools or programs won’t work because it is based on Windows.
Get the most up-to-date package information from all the sources available by running the following command:
sudo apt update
Install any updates that are available by running the following command:
To install Firefox, follow these steps:
sudo apt install firefox
To use Firefox, follow these steps:
You’ll see that Firefox isn’t open if you already have it installed on your Windows system. It is due to the fact that you are now using Firefox for Linux rather than Windows. If you’re using Windows 11, you can even launch Firefox for Linux from the start menu. It’ll be in the folder for your distro.
How efficient are Linux GUI applications on Windows 11?
Playing the Linux version of Tux Racer on Windows 11 is geeky and fun, but it’s hardly the most practical use of Microsoft’s virtualization technology. So, are Linux graphical user interface (GUI) programs on Windows 11 genuinely helpful? They are, without a doubt! To begin, not all Linux software is compatible with Windows. While Evolution, Geary, GNOME Web (Epiphany), Vocal, and Rapid Photo Downloader may not have the same widespread appeal as Adobe Creative Suite or Final Cut Pro, they have a following that appreciates the ability to operate them on Windows.
WSLg, on the other hand, is a godsend to developers since it allows them to build and test their programs on Linux without having to leave Windows or boot a heavyweight virtual machine. Web developers can quickly install Linux web browsers and test how well their websites display in them.
Last but not least, the current version of WSL is an excellent method to expose someone to the beautiful world of Linux—not only the terminal side of things—thereby encouraging the development of a new generation of Linux developers, administrators, and regular users.
How to use the Windows Subsystem for Linux on Windows 11
Without reinstalling or dual-booting your PC, you may use the Windows Subsystem for Linux on Windows 11 to get full access to Linux apps and services. WSL is the ideal way to run Linux software on a Windows PC, and you can always switch to a different distribution via the Microsoft Store or the new Windows Terminal app if you don’t like the one you’re using.
If you’re new to Windows 11, check out the other optional options, such as running retro games and apps with older.NET Frameworks.
Windows 11 has been officially released, and it comes with a slew of new features. The ability to execute Linux GUI programs using WSL (Windows Subsystem for Linux) version 2 is one of the most impressive features. This functionality was previously only available to Windows Insiders, but it is now open to all users.
WSL is a lightweight virtualization solution that enables the execution of Linux binaries on a Windows machine. WSL was first published in 2016, and its development has continued since then, with the most recent major release, WSL 2, available for Windows 11 Build 22000 and higher.