M HYPE SPLASH
// general

What is the difference between Windows Subsystem for Linux and bash on Ubuntu on Windows?

By Sarah Scott
  1. What is the difference in their functions? Is one of them more compatible or something else? Why Microsoft bother developing these two which look identical?
  2. The file location. Files for the bash on Ubuntu on Windows are located in C:\Users\<username>\AppData\Local\lxss, but where are they for WSL? There is an answer which claims them to be at C:\Users\<username>\AppData\Local\Lxss\rootfs, but I find it empty.
  3. Is there an ".exe" for WSL? For bash on Ubuntu on Windows it is "C:\Windows\sysnative\bash.exe". Is there something like this for WSL so I can use it in Visual Studio Code?

2 Answers

"Bash on Ubuntu on Windows" is based on Windows Subsystem for Linux. WSL is an implementation of Linux system calls on the Windows' NT kernel, which allows you to run Linux executables unmodified (like Wine does for Ubuntu). "Bash on Ubuntu on Windows" is just one application of WSL. Other Linux distros like openSUSE or Fedora are either available or will soon be available.

There are "exe"s for WSL. Originally there used to bash.exe, then came wsl.exe, and now there's ubuntu.exe and openSUSE-42.exe. Presumably fedora.exe will appear soon. From the MSDN post Manage multiple Linux Distributions in WSL:

There are three ways to launch and run WSL:

  • wsl.exe or bash.exe
  • wsl -c [command] or bash -c [command]
  • [distro], i.e., ubuntu -- this is the same as launching the installed app from the Windows menu.

In the first two cases, WSL must pick a distribution to run - a default distribution. If you don't explicitly set a default, it will be the first one installed.

Where the files for WSL are will depend on the distro, now that they are apps installed from the store:

Each distribution you install through the store is installed to that application's appdata directory. For example: C:\Users\<username>\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState

2

Dug around to find this, hope this helps

From Microsoft

Available in Windows Build 17092 (version 1903) and prior

In Windows 10 prior to version 1903, the WSL Config (wslconfig.exe) command-line tool should be used to manage Linux distributions running on the Windows Subsystem for Linux (WSL). It lets you list available distributions, set a default distribution, and uninstall distributions.

To list distributions, use:

wslconfig /listLists available Linux distributions available to WSL. If a distribution is listed, it's installed and ready to use.

wslconfig /list /allLists all distributions, including ones that aren't currently usable. They may be in the process of installing, uninstalling, or are in a broken state.

To set a default distribution that runs when you run wsl on a command line:

wslconfig /setdefault <DistributionName> Sets the default distribution to .

Example: (using PowerShell)wslconfig /setdefault Ubuntu would set my default distribution to Ubuntu. Now when I run wsl npm init it will run in Ubuntu. If I run wsl it will open an Ubuntu session.

To unregister and reinstall a distribution:

wslconfig /unregister <DistributionName>Unregisters the distribution from WSL so it can be reinstalled or cleaned up.

For example: wslconfig /unregister Ubuntu would remove Ubuntu from the distributions available in WSL. When I run wslconfig /list it will not be listed.

Available in Windows Build 17093 and later

Configure per distro launch settings with wslconf

Automatically configure certain functionality in WSL that will be applied every time you launch the subsystem using wsl.conf.

Right now, this includes automount options and network configuration.

wsl.conf is located in each Linux distribution in /etc/wsl.conf. If the file is not there, you can create it yourself. WSL will detect the existence of the file and will read its contents. If the file is missing or malformed (that is, improper markup formatting), WSL will continue to launch as normal.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy