Windows Subsystem for Linux

The Windows Subsystem for Linux (WSL) is available as a feature on Windows 10 and out-of-the-box supports Ubuntu running within Windows. This is the simplest option if you have Windows 10 (1709 or later) installed (see Settings -> System -> About). It also requires the installation of XMing or VcXsrv. Microsoft also released WSLv2 in May 2020 to incorporate the Linux kernel directly within Windows, so as to deliver significant performance gains and support more applications.

To get started:

  • Install XMing on Windows.
  • Go to ‘Turn Windows Features On or Off’ (Control Panel -> Programs -> Programs and Features), tick on the box ‘Windows Subsystem for Linux’ to install WSL and reboot.
  • Go to Microsoft Store and search for the latest Ubuntu distribution to install.
  • Launch Ubuntu from the Start menu or else type the command “ubuntu” in the Powershell.
  • For GUI applications run the command $ export┬áDISPLAY=:0 in the Ubuntu terminal window.

See https://github.com/simonzhaoms/tips/blob/master/wsl.md for more details on using WSL.

Some Tips

Files from your Windows C: drive, for example, can be accessed from Ubuntu as /mnt/c. Thus if you have a photo on the C: drive (at the root of the C: drive) called myphoto.jpg, then within Ubuntu:

$ ml faces azcv /mnt/c/myphoto.jpg

Copy and paste for the terminal with WSL needs to be enabled. Right-click on the toolbar (or click on the icon in the upper left corner), select Properties, and in the the Options tab ensure the “Use Ctrl+Shift+C/V as Copy/Paste” checkbox is ticked.