Skip to content

Cross-OS command execution

Cross-OS command execution refers to the ability to invoke tools and utilities native to one operating system (OS) from the command line interface of another. A primary implementation of this involves running Linux tools directly from the Windows command prompt via the Windows Subsystem for Linux (WSL).^[400-devops-02-os-and-linux-basics-windows-wsl.md]

Mechanism

This interoperability allows users to execute Linux binaries while remaining in the Windows environment.^[400-devops-02-os-and-linux-basics-windows-wsl.md] For example, the wsl command can be used to invoke Linux commands.^[400-devops-02-os-and-linux-basics-windows-wsl.md]

Usage Example

To list the files of a Windows directory using the Linux ls command, one can use the following syntax in Command Prompt or PowerShell^[400-devops-02-os-and-linux-basics-windows-wsl.md]:

C:\temp> wsl ls -la
<- contents of C:\temp ->

Best Practices

While cross-OS execution offers flexibility, it is generally recommended not to manipulate files across operating systems.^[400-devops-02-os-and-linux-basics-windows-wsl.md]

  • [[Windows Subsystem for Linux]]
  • [[WSL]]

Sources