Mike Slinn
Mike Slinn

Windows Subsystem for Linux Revisited

Published 2018-08-20. Last modified 2023-09-26.
Time to read: 2 minutes.

This page is part of the posts collection, categorized under Git, Ubuntu, WSL.
Windows Subsystem for Linux (WSL)

I’ve been using Windows Subsystem for Linux (WSL) headless since it was first released with Windows 10 version 1607 in August 2016. The April 2018 release of Windows 10 (version 1803) significantly improved WSL.

It is possible to work with Ubuntu graphically on a vanilla Windows machine. No special drivers are required. No special Linux or Ubuntu support is required from the computer vendor.

This is my setup for running an X client like xeyes or IntelliJ IDEA from WSL or WSL2, accessed via a Windows X server like VcXsrv. These scripts assume Ubuntu 18.04 was installed under WSL.

Desktop showing Windows Subsystem for Linux (WSL)

Essential Scripts

Here are bash scripts to install everything:

Optional Scripts

The remaining scripts are all optional.

VNC

These bash scripts allow VNC to connect to a remote machine or to WSL on the local machine.

Packages and Programming Environments

Installation of various packages and programming environments follow.

Git

Python

NodeJS

Java Virtual Machine

Miscellaneous

Atom Editor

Wine

The advent of WSL means that Wine is no longer required!

Configuration

This is my WSL configuration file, in my Windows home directory (%systemdrive%%homepath%\.wslconfig). See Advanced settings configuration in WSL for more information.

%systemdrive%%homepath%\.wslconfig
# See https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig
# See https://github.com/microsoft/WSL/issues/4166
[wsl2]
memory=8GB
swap=60GB
#processor=4
localhostForwarding=true

[experimental]
autoMemoryReclaim=drop
sparseVhd=true

Upgrading from Ubuntu 19.11 to Ubuntu 20.04

Update Aug 17, 2020: Here are my notes on upgrading WSL and WSL2 from Ubuntu 19.11 to Ubuntu 20.04.

Run Associated Windows Program

To run the Windows program associated with a file, preface the file with cmd.exe /C start.

For example, to run the default Windows video viewer for .mkv files, type:

Shell
$ cmd.exe /C start my_file.mkv

I defined a bash alias to make this easier:

~/.bash_aliases
alias run='cmd.exe /C start'