There are two ways that Linux utilities can be run on Windows:-
- Compile the code as a native Windows .EXE file: this is what CygWin does, which is how all the individual utilities are available individually for direct invocation from a Windows shell.
- Provide an environment within Windows in which Linux native ELF binaries can run, in a manner similar to how Linux runs Windows programs under Wine: this is what Windows Subsystem for Linux does, and the individual programs are not recognised as executables outside this environment.
The WSL environment is launched when bash.exe
is run, and you can run WSL utilities by invoking through bash.exe
, eg:
bash -c ls
If you need to pass parameters, you will need to quote the command string, eg:
bash -c 'ls -l ./Documents/'
I haven't checked CygWin, but some native Windows ports allow flexibility in their run strings (eg /
instead of -
for options, and \
instead of /
for directory separators) - with WSL you will need to use strict Linux run strings.
Read this blog post for detailed information.
– Biswapriyo – 2019-05-08T16:43:57.717