Table of contents

Command Reference

Jack Hammons|Last Updated: 12/2/2016
|
5 Contributors

Important note
This is the first release of this brand new technology and it is branded “beta” deliberately – it’s not yet complete! We know there are issues and incomplete features, you should expect some things to work and for many things to fail. But we appreciate you playing with this feature and helping us identify the issues we need to fix in order to deliver a great experience.

The commands bash.exe and lxrun.exe are used to interact with the Windows Subsystem for Linux (WSL). These commands are installed into the \Windows\System32 directory and may be run within a Windows command prompt or in PowerShell.

  • bash.exe launches the Bash environment and invokes /bin/bash.
  • lxrun.exe is used to manage WSL. This command can be used to install or uninstall the Ubuntu image.
CommandDescription
bashLaunches the Bash shell in the current directory. If the Bash shell is not installed automatically runs lxrun /install
bash ~Launches the bash shell into the user's Ubuntu home directory. Similar to running cd ~
bash -c "<command>"Runs the command, prints the output and exits back to the Windows command prompt.

Example: bash -c "ls"

CommandDescription
lxrunThe lxrun command is used to manage the WSL instance.
lxrun /installStarts the download and install process.
/y may be added to bypass all prompts. The confirmation prompt is automatically accepted and the default user is set to root.
lxrun /uninstallUninstalls and deletes the Ubuntu image. By default this does not remove the user's Ubuntu home directory.
/y may be added to automatically accept the confirmation prompt
/full uninstalls and deletes the user's Ubuntu home directory
lxrun /setdefaultuser <userName>Sets the default Bash on Ubuntu user. Will prompt for a password if the specified user does not exist. For more information visit: http://aka.ms/wslusers.
/y Bypasses promping for the password. The user will be created without a password.
lxrun /updateUpdates the subsystem's package index
© 2017 Microsoft