Skip to content

WSL command-line interoperability

WSL command-line interoperability allows Windows and Linux environments to interact directly from the command line. This enables users to invoke Linux tools from Windows and vice versa, as well as access network resources across the two operating systems.^[400-devops__02-OS-and-Linux-Basics__windows__wsl.md]

Windows to Linux

From a Windows command-line interface (such as PowerShell or CMD), users can execute Linux binaries directly using the wsl command followed by the Linux utility.^[400-devops__02-OS-and-Linux-Basics__windows__wsl.md]

For example, the command wsl ls -la can be run in a Windows directory to list its contents using the Linux ls utility.^[400-devops__02-OS-and-Linux-Basics__windows__wsl.md]

Linux to Windows

Conversely, Windows tools can be invoked from within the WSL Linux environment. A primary use case is file system navigation; for instance, running explorer.exe . from a Linux directory will open the current folder in the Windows File Explorer.^[400-devops__02-OS-and-Linux-Basics__windows__wsl.md]

Networking

WSL manages networking to allow connectivity between the two environments:

  • Windows accessing Linux apps: Applications running in WSL can be accessed via localhost from Windows.^[400-devops__02-OS-and-Linux-Basics__windows__wsl.md]
  • Linux accessing Windows apps: Linux can access Windows network applications using the host's IP address, which can be identified by checking the contents of /etc/resolv.conf.^[400-devops__02-OS-and-Linux-Basics__windows__wsl.md]
  • [[WSL]]
  • [[Bash]]
  • [[PowerShell]]
  • [[Command line interface]]

Sources

  • 400-devops__02-OS-and-Linux-Basics__windows__wsl.md