To jump from any directory back to home from within a WSL command prompt, you can use the command: cd ~. The ~ can be used with wsl to start in the user's home directory. To set the default Linux distribution that WSL commands will use to run, replace with the name of your preferred Linux distribution. Set default Linux distribution wsl -set-default To set a default version of WSL 1 or WSL 2, replacing with either the number 1 or 2 to represent which version of WSL you would like the installation to default on for new Linux distribution installations.
Set default WSL version wsl -set-default-version To designate the version of WSL (1 or 2) that a Linux distribution is running on, replace with the name of the distribution and replace with 1 or 2. Set WSL version to 1 or 2 wsl -set-version Additional options that can be used with the list command include: -all to list all distributions, -running to list only distributions that are currently running, or -quiet to only show distribution names.
This command can also be entered as: wsl -l -v. See a list of the Linux distributions installed on your Windows machine, including the state (whether the distribution is running or stopped) and the version of WSL running the distribution (WSL 1 or WSL 2). List installed Linux distributions wsl -list -verbose This command can also be entered as: wsl -l -o. See a list of the Linux distributions available through the online store. List available Linux distributions wsl -list -online This command can also be entered as: wsl -d.
Windows command prompt commands cheat sheet install#
Install a specific Linux distribution wsl -install -distribution ĭesignate a distribution of Linux for installation besides the default (Ubuntu) by replacing with the name of the distribution. Install WSL and the Ubuntu distribution of Linux. To run these commands from a Bash / Linux distribution command line, you must replace wsl with wsl.exe. The WSL commands below are listed in a format supported by PowerShell or Windows Command Prompt.