This command may be necessary in instances that require you to restart the WSL 2 virtual machine environment, such as changing memory usage limits or making a change to your. Immediately terminates all running distributions and the WSL 2 lightweight utility virtual machine. See the Automount options in the Advanced Settings Configuration doc. You can instead change the default user for imported distributions using the /etc/wsl.conf file. This command will not work for imported distributions, because these distributions do not have an executable launcher. Ubuntu config -default-user johndoe would change the default user for the Ubuntu distribution to the "johndoe" user. The user has to already exist inside the distribution in order to become the default user. Change the default user for a distribution config -default-user Ĭhange the default user for your distribution log-in. To run WSL as a specified user, replace with the name of a user that exists in the WSL distribution. Run as a specific user wsl -u `, `wsl -user See a list of options and commands available with WSL. See general information about your WSL configuration, such as default distribution type, default distribution, and kernel version. You can also use the command: wsl -update rollback to rollback to a previous version of the WSL Linux kernel. Manually update the version of your WSL Linux kernel. To print the current user name, use the command whoami. If the user doesn't exist in the WSL distribution, you will receive an error. Debian) and with the name of an existing user (ie. To run a specific Linux distribution with a specific user, replace with the name of your preferred Linux distribution (ie. Run a specific Linux distribution from PowerShell or CMD wsl -distribution -user 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. 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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |