4

How do I open the WSL CLI on Windows 10?

I installed WSL on my Windows 10 system, but I have no idea how to access the WSL CLI. All the tutorials on the internet assume that the CLI is already open.

2
  • After you installed a Linux distro, you should see it in the Start menu, ex: search for Ubunu and then run it, it should start up and present you with a CLI window.
    – essjae
    Dec 2, 2022 at 11:16
  • @essjae, worked. thx Dec 2, 2022 at 12:43

1 Answer 1

6

There are multiple options for starting WSL:

  • Recommended method: It's highly recommended that you install Windows Terminal from the Microsoft Store. This is a modern terminal replacement which supports running multiple profiles with multiple tabs. It is now the default terminal in Windows 11, but is also supported in Windows 10.

    After installing Windows Terminal, it will automatically detect all of your compatible console applications (PowerShell, WSL distributions, CMD, etc.) and create profiles for them. You can launch WSL from Windows Terminal simply by clicking the dropdown menu and selecting your distribution.

  • As mentioned in the comments, the distribution you use will typically be installed in the Start menu. The default distribution for WSL is Ubuntu, so search for Ubuntu there. There are, however, quite a few different distributions you might use (I currently have about 20 installed, but that's extreme). Run wsl.exe -l -v from a command prompt to determine exactly which ones you have installed.

  • If you are using the latest version of WSL, it will also appear separately in the Start menu as Windows Subsystem for Linux. Clicking on that result will run WSL with its default distribution. You can see the default distribution with wsl.exe --status or wsl.exe --list --verbose (from PowerShell, CMD, or WSL. You can change the default distribution by running wsl.exe --set-default <other_distro_name>.

  • You can run WSL directly from any already open command-line by simply running wsl. This will launch the default distribution. There are plenty of command-line switches available, so check out wsl --help for full details. These commands can also give you additional flexibility when creating new profiles in Windows Terminal. Some useful commands:

    • wsl ~: Starts the default distribution in the Linux user's home directory
    • wsl ~ -d <other_distro>: Launch a different distribution (e.g. Debian, Arch Linux, Artix, etc.)
    • wsl ~ -e bash --noprofile --norc: Launch the Bash shell without running your Bash startup files (useful for debugging or recovery).
    • wsl ~ -u root: Launch WSL as the root user - Useful for recovery.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .