11
  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?
13

"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

| improve this answer | |
  • 2
    Which is one of the reasons Microsoft retired Bash on Ubuntu on Windows once they introduced multiple WSL distributions. The feature is officially called WSL which stands for Windows Subsystem for Linux. Bash on Ubuntu on Windows came from the ability to run (Linux) bash scripts within a Ubuntu kernel on Windows. – Ramhound Oct 23 '17 at 16:51
  • 6
    The funny thing is that running bash.exe or (more precisely, C:\Windows\System32\bash.exe), still "works", however it gives a different environment than [ubuntu|<distro>].exe, which complicates things a lot. Frankly, I don't know why bash.exe still exists or why it doesn't just route to the preferred distro. Edit: Use wslconfig from cmd. – Christian Jul 3 '18 at 19:40

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.