EECS 280 Tutorials

Windows Command line tools (WSL)

The Windows Subsystem for Linux (WSL) runs an Ubuntu Linux guest virtual machine on your Windows host machine.

When you see $ in this tutorial, you should type into your shell the command that comes after the $.

Upgrade Windows

We recommend Windows 11. Windows 10 version 2004 build 19041 and higher will also work. Here’s how to check your Windows version.

Free Windows upgrades are available for UM students via OnTheHub. If you have an older Windows machine and are not able to upgrade, please reach out to course instructors for assistance.

Install WSL

Start PowerShell and run it as administrator. Search for PowerShell in the start menu, then right-click and select “Run as administrator”. (Note: these instructions are based on the instructions from Microsoft.)

Check if WSL was already installed. If you see this, WSL is already installed.

C:\WINDOWS\system32> wsl -l -v
* Ubuntu    Stopped     2

If you see the WSL help text, WSL is not installed.

C:\WINDOWS\system32> wsl -l -v
Copyright (c) Microsoft Corporation. All rights reserved.
Usage: wsl.exe [Argument]

Install WSL.

C:\WINDOWS\system32> wsl --install

Pitfall: Make sure Windows Update is enabled and your machine is up-to-date. Settings > Update and Security > Windows Update.

Pitfall: If you still get an error from wsl --install, try the Manual installation steps.

For the Linux distribution, choose the latest version of Ubuntu LTS. At the time of this writing, that’s Ubuntu 22.04 LTS.

Restart your computer.

Start PowerShell as administrator, and check that the VERSION is 2.

C:\WINDOWS\system32> wsl -l -v
* Ubuntu    Stopped     2

If the VERSION is 1, you must upgrade to WSL 2.

Open terminal

Start an Ubuntu Bash shell.

First time: create account

The first time you open Ubuntu, you will be prompted to create a Linux username and password. Follow the prompts to create one.

Double check that your user has been created.

$ whoami
awdeorio  # this should NOT say root

Pitfall: If you are signed in as root, something has gone wrong.

$ whoami
root  # SOMEthiNG IS WRONG

We recommend you completely reinstall Ubuntu. (Note this will delete all of the data associated with Ubuntu. If you’ve just installed it, that’s fine.)

Open PowerShell and run it as administrator. Run the commands below. You’ll be prompted to create a user account.

PS C:\Users\awdeorio> wsl --unregister Ubuntu
The operation completed successfully.

PS C:\Users\awdeorio> wsl --install -d Ubuntu
Ubuntu is already installed.
Launching Ubuntu...
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit:
Enter a new UNIX username:

Install CLI tools

From an Ubuntu terminal, use the apt package manager to install a few command line programs. Linux users will run this same command.

$ sudo apt update
$ sudo apt install g++ make rsync wget git ssh gdb python3 tree

Use CLI tools

Now would be a great time to take a look at our CLI Tutorial.


Accessing Linux files from Windows

To access Linux files from the Windows File Explorer, click the Linux icon. You may need to scroll down.

Navigate to your home directory: Linux > Ubuntu > home > awdeorio. Your username will be different.

Pro-tip: Right click your Linux home directory and choose “Pin to Quick access”.

It should now show up under “Quick access” in the left sidebar.

To open the File Explorer in any directory at the WSL (Ubuntu) Terminal:

$ explorer.exe .

Accessing Windows files from Linux

To access Windows files from Linux, navigate to /mnt/c/.

For example, here’s how to access your Windows Desktop. Your username will be different.

$ cd /mnt/c/Users
$ ls
'All Users'  'Default User'   defaultuser0   awdeorio   Default   Public   defaultuser100000   desktop.ini
$ cd awdeorio
$ ls
... Desktop  Downloads ...
$ cd Desktop

CLI open file

Opens a file or directory with the default application, like a double click. See the wslview command in the CLI tutorial.

Copy paste

Copy: ctrl + shift + c

Paste: ctrl + shift + v

If Copy/Paste doesn’t work, read on to enable it.

Enable copy paste

These instructions show how to enable WSL Copy/Paste on Windows 11 H2 or newer.

Right click on the window pane header of your Ubuntu WSL terminal. Click on the Settings option in the drop down menu.

Pitfall: If your dropdown contains the option “Properties” follow the instructions for Older versions of windows.

Click on the Actions tab on the left side of the settings window.

Confirm that the “Copy text” and “Paste text” bindings exist. You may need to scroll down. Add them if needed using the “Add new” button.

Enable copy paste on older Windows

These instructions show how to enable WSL Copy/Paste on version of Windows older than 11 H2.

Click on the properties option in the dropdown.

Enable “Use Ctrl+Shift+C/V Copy/Paste” option in the Console “Options” properties page


Spaces in paths

Avoid paths that contain spaces. Spaces causes problems with some command line tools.

Bad Example Good Example
EECS 280/ eecs280/
Project 1 Stats/ p1-stats/

Project folder in Windows home directory

Linux (Ubuntu) has a separate home directory. Storing code in your Windows home directory can cause slowdowns because WSL uses a network file share to communicate the files between Windows and Linux.

Bad Example Good Example
/c/mnt/Users/awdeorio ... /home/awdeorio ...

Here’s how to access your Linux files from Windows.

Root user

Avoid doing everyday coding as the root user in WSL. Some programs don’t work correctly when run as root. When you first installed Ubuntu, you should have been prompted to create a Linux username and password.

Bad example: If the default is a root login, here’s how to change your linux username and password. For the same reasons, avoid using su or su root.

$ whoami

Good example: When you start a Bash shell (not a Windows PowerShell), you should have a non-root username.

$ whoami


Original document written by Andrew DeOrio

This document is licensed under a Creative Commons Attribution-NonCommercial 4.0 License. You’re free to copy and share this document, but not to sell it. You may not share source code provided with this document.