The Windows 10 anniversary update introduced a major new feature: a subsystem for Linux. Microsoft marketing execs call this Bash on Windows; Ubuntu calls it Ubuntu on Windows; but Windows Subsystem for Linux is the most accurate description. You run a Linux binary and the subsystem redirects system calls so that it behaves like Linux.
The first implementation (which is designated Beta) has an obvious limitation. Linux works great, and Windows works great, but they do not interoperate, other than via the file system or networking. This means you cannot do what I used to do in the days of Services for Unix: type ls at the command prompt to get a directory listing.
That is now changing. Version 14951 introduces interop so that you can launch Windows executables from the Bash shell and vice versa. This is particularly helpful since the subsystem does not support GUI applications. One of the obvious use cases is launching a GUI editor from Bash, such as Visual Studio Code or Notepad++.
The nitty-gritty on how it works is here.
Limitations? A few. Environment variables are not shared so an executable that is on the Windows PATH may not be on the Linux PATH. The executable also needs to be on a filesystem compatible with DrvFs, which means NTFS or ReFS, not FAT32 or exFAT.
This is good stuff though. If you work on Windows, but love Linux utilities like grep, now you can use them seamlessly from Windows. And if you are developing Linux applications with say PHP or Node.js, now you can develop in the Linux environment but use Windows editors.
Note that this is all still in preview and I am not aware of an announced date for the first non-beta release.
We can already use tools like grep and ls, and have been able to do so for years. These tools are part of the GNU toolset, and are open source. There are plenty of ports of them that target Win32.
Thanks David. This is a different thing, but yes.
In fact I’ve discovered that you still cannot just type ls. You have to type:
bash -c ls
but you can made a file ls.cmd containing:
bash.exe -c ‘ls %*’
if you want a workaround (suggestion from Microsoft’s Ben Hillis).
Tim