How to Set Your Default Linux Distribution on Windows 10
Windows 10 now allows you to install multiple Linux environments, starting with the Fall Creators Update. If you have multiple Linux environments, you can set your default and switch between them.
You’re free to run multiple Linux environments at once, but your default environment is used when you run a command like
bash.exe to launch the shell, or when you use
wsl [command] or
bash -c [command] to run a command from elsewhere in Windows.
wslconfig.exe command lets you manage the Linux distributions running via the Windows Subsystem for Linux, or WSL.
To run it, you would like to open either a electronic communication or PowerShell window.
To view your put in Linux distributions, kind the subsequent command and hit Enter:
The Linux distribution ending with “(Default)” is your default Linux distribution.
Read Also: Apache Cassandra Tutorial
To set your default Linux distribution, run the following command, where Name is the name of the Linux distribution:
wslconfig /setdefault Name
For example, to set Ubuntu as your default Linux distribution, run the following command:
wslconfig /setdefault Ubuntu
bashcommands, the Linux distribution you selected opens.
Your default Linux distribution is also used when you run individual commandswith either
wsl command or
bash -c command.
How to Run Multiple Linux Distributions
To launch a Linux distribution from the command line or via a shortcut, just use its command. The command you need is displayed on the Linux distribution’s page in the Microsoft Store. Here are the commands you’ll need to launch the three initial three Linux distributions:
- openSUSE Leap 42:
- SUSE Linux Enterprise Server 12:
These commands also work with the same
-c switch you can use with the
bash.execommand. Just use the below command structure, where “distro-command” is the same command you use to launch the Linux distribution and “command” is the Linux command you want to run.
distro-command -c command
In other words, even if openSUSE Leap is your default Linux distribution, you can still run a command on Ubuntu from a command-line environment or script just by running
ubuntu -c command .
For example, to run the
apt-get moo command that shows an Easter egg on Ubuntu, you’d run the following command:
ubuntu -c apt-get moo