3 minutes read

In the course of your work, you will have to deal with programs and tools designed to work through the command-line terminal. To use such programs, it is best to work on a UNIX-like operating system, such as Linux or MacOS. However, if you are using Windows, then you do not need to change operating systems or install multiple operating systems on your computer. You can use Windows Subsystem for Linux (WSL) instead.

What is WSL?

WSL is a Windows feature that allows you to run all the tools you need on Linux and use the full potential of the command line. With WSL, you can install and run both command line tools and graphical Linux applications that will be integrated directly into your Windows desktop. You can also run Windows applications using the same command line.

There are many different distributions — operating systems based on the Linux kernel with certain pre-installed programs and features. Ubuntu is one of the most popular distributions and is best suited for beginner users. If you have questions about working with the system, it will be easiest for you to find a solution specifically for Ubuntu. However, if you wish, you can choose any other Linux distribution that suits you.

Also at the moment, there are two versions — WSL 1 and WSL 2. You can read more about their differences in the official Microsoft documentation, in the section "Comparing WSL Versions". In short, although both versions provide integration between Windows and Linux, WSL 2 provides full Linux kernel and full system call compatibility compared to WSL 1.

Install WSL

In order to install WSL you need Windows 10 version 2004 or later or Windows 11. In case your operating system version is of an earlier version, you need to study the explanation from Microsoft's official documentation in the following section.

In case your system meets the requirements, you need to open Windows Power Shell (in the administrator mode) and execute a simple command. By default it will be WSL 2 and the Ubuntu distribution:

wsl --install

Windows Power Shell with the installation command

After installation, you will have to restart your computer.

This command will download and install the Linux kernel. As we already pointed out, by default it will be WSL 2 and the distribution will be Ubuntu. If you want to change the default Linux distribution, you will need to write the command:

wsl --install -d <Distribution Name>

In this case, instead of <Distribution Name>, you will need to write the name of the desired distribution. To view the list of available distributions you can enter the command:

wsl --list --online

Basic commands and first steps

After the installation is complete, you can find out general information about the WSL configuration (default distribution and kernel version) with the command:

wsl --status

If you want to update your WSL to the latest version, then the following command will help you:

wsl --update

To see the full list of commands available in WSL you can use:

wsl --help

But most importantly, when the installation process is complete, you will be able to open the distribution you have installed (Ubuntu by default) via the start menu.

Apps menu: Ubuntu distribution

After you open this app, you will be prompted to create a username and password for your Linux subsystem. The username and password you choose will be used for future work in your distribution.

Running Ubuntu fot the first time

Don't be afraid that you won't see what you're typing on the screen when you enter your password — this is normal for Linux. It is important that the user you create will be considered an administrator of the system and you will be able to run administrative commands as the root user using sudo.

As the first command you write on your command line, you can update and upgrade preinstalled packages. In the future, it is recommended to do this regularly. To do this, use the following command:

sudo apt update && sudo apt upgrade

To install the tools you need into your subsystem, you can use the sudo apt-get install <software name> command. For example, if you need to install the git version control system, you can issue the command:

sudo apt-get install git

After completing these steps, you can safely use the WSL you have installed. In case you are having trouble installing it, you can check the "Troubleshooting Windows Subsystem for Linux" section. We invite you to read the full documentation on the Microsoft website to learn how to install and use the programs you need.

Conclusion

Now you know how to install and start using Windows Substytem for Linux on your computer. Thus, you can enjoy all the benefits of Linux, while still having Windows as the main system on your computer.

3 learners liked this piece of theory. 0 didn't like it. What about you?
Report a typo