DEV Community

Loránd Márton
Loránd Márton

Posted on

Just start using WSL

Introduction

WSL lets you run Linux on your Windows machine, giving you access to the best of both worlds for development.

Get an awesome tool: WSL

To install WSL, open the terminal and run the following command:

wsl --install --no-distribution
Enter fullscreen mode Exit fullscreen mode

This command installs WSL without the default Ubuntu distribution. If the wsl command doesn't work use wsl.exe instead.

Restart your computer, to complete the installation.

To check the list of available distributions, run:

wsl --list --online
Enter fullscreen mode Exit fullscreen mode

You should see something like this:

NAME                            FRIENDLY NAME
Ubuntu                          Ubuntu
Debian                          Debian GNU/Linux
kali-linux                      Kali Linux Rolling
Ubuntu-18.04                    Ubuntu 18.04 LTS
Ubuntu-20.04                    Ubuntu 20.04 LTS
Ubuntu-22.04                    Ubuntu 22.04 LTS
Ubuntu-24.04                    Ubuntu 24.04 LTS
OracleLinux_7_9                 Oracle Linux 7.9
OracleLinux_8_7                 Oracle Linux 8.7
OracleLinux_9_1                 Oracle Linux 9.1
openSUSE-Leap-15.6              openSUSE Leap 15.6
SUSE-Linux-Enterprise-15-SP5    SUSE Linux Enterprise 15 SP5
SUSE-Linux-Enterprise-15-SP6    SUSE Linux Enterprise 15 SP6
openSUSE-Tumbleweed             openSUSE Tumbleweed
Enter fullscreen mode Exit fullscreen mode

Install one of these distributions with:

wsl --install <Distro>
Enter fullscreen mode Exit fullscreen mode

This command will install your chosen distribution. For getting familiar with WSL, Ubuntu or Debian are good starting points.
When installed, you have to choose username and password.

If you install multiple distributions, you can set a default with:

wsl --set-default <DistributionName>
Enter fullscreen mode Exit fullscreen mode

Setting a default distribution ensures that when you open WSL without specifying a distribution it will start your preferred environment.
You can either start the distribution, you can use the current working directory or the distribution's user home directory:

  • Current working directory:
wsl
Enter fullscreen mode Exit fullscreen mode
  • User's home directory:
wsl ~
Enter fullscreen mode Exit fullscreen mode

To list the installed distributions, run:

wsl --list --verbose
Enter fullscreen mode Exit fullscreen mode

Check the running distributions:

wsl -l --running
Enter fullscreen mode Exit fullscreen mode

Stop a running distribution:

wsl --terminate <Distribution Name>
Enter fullscreen mode Exit fullscreen mode

WSL is a powerful tool that brings the Linux experience directly into Windows, allowing for a flexible development environment.

References

Top comments (2)

Collapse
 
larastewart_engdev profile image
Lara Stewart - DevOps Cloud Engineer

Do you want a better advice?

For quite some time to get your hands dirty, use WSL. After a few months just use your choice of linux distro full time.

Windows and Linux together does not go well.

Collapse
 
aalvarado profile image
aalvarado

Another alternative is to use HyperV to manage virtual machines. You can install any distro you like and works much closer to the native experience.