Updated: 10/17/2017 by Computer Hope
WSL, the Windows Subsystem for Linux, is a free, optional feature of Windows 10 that allows Linux programs to run on Windows. It provides you with a Windows version of the bash shell and a compatibility layer that permits many Linux programs to run natively on your Windows machine.
Before installing WSL, make sure that your computer meets the minimum system requirements to run WSL:
- You must be running Windows 10 version 1607 (the Anniversary update) or above.
- WSL will only run on 64-bit versions of Windows 10. 32-bit versions are not supported.
To check that you meet these requirements, follow these steps:
- Open your Settings. You can do this by clicking the gear icon on the Start menu, or by opening the Power User Tasks menu and choosing Settings.
- In the Settings window, choose System.
- On the left side of the System window, choose About.
- On the right side of the window, you will see your system information. Make sure that the Version is at least 1607, and the System type is a 64-bit operating system.
If the “Version” number is less than 1607, you will need to perform a Windows Update before installing WSL. (This is a good idea anyway because it provides important security updates.)
If your “System type” is not a 64-bit operating system, you will not be able to run WSL.
To install WSL, follow these steps:
- Open a new PowerShell window as Administrator. To do this, open your Start Menu, scroll down to W, and expand the Windows PowerShell folder. You will see several items. Right-click Windows PowerShell, choose More, then Run as administrator.
- At the PowerShell prompt, run this command:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- The WSL software will download. When it’s done, PowerShell will ask if you’re ready to reboot the computer. If you have other applications open, make sure any documents are saved, and the applications are closed. In PowerShell, type y and press Enter to reboot.
- Log in to Windows, and open a new Command prompt (or PowerShell). At the prompt, run:
- The first time you run bash, it will ask you if you want to install Ubuntu on Windows.
-- Beta feature -- This will install Ubuntu on Windows, distributed by Canonical and licensed under its terms available here: https://aka.ms/uowterms Type "y" to continue:
Type y and press Enter to start the Installation.
- When the installation is complete, you’re almost ready to use WSL. First, you need to create a new user just for Linux to use when running programs in bash. The name does not have to be the same as your Windows login — it can be whatever you want. Enter a name, and choose a password.
Congratulations! Linux is running. You’re now at the bash prompt, and you can run Linux commands and programs.
Update WSL software packages
At this point, it’s a good idea to update your Linux software. Just like Ubuntu, WSL uses the Advanced Packaging Tool (APT) to manage software packages. The apt command allows you to search for, download, and install software, all from the command line. It automatically manages your software dependencies for you, so if one program depends on a certain version of another program, both will be installed, and kept up to date.
First, update your local information about what software is available. To do this, you will run the command apt update with the word sudo at the beginning. The sudo command, or “superuser do”, asks for your password, then runs the rest of the command as the superuser (the root account).
sudo apt update
Updates will download, but nothing is installed or upgraded yet. To upgrade all available packages, run:
sudo apt upgrade
Tip: Sudo will not ask you for your password this time, unless it has been more than five minutes since the last sudo command.
The size of the upgrades will be calculated, and you will be prompted to continue. Type y and press Enter. The upgrades will download and install, which might take a while, depending on the speed of your computer and Internet connection.
When the upgrade is complete, you will be returned to the bash prompt. Your Linux system is now up to date.
At any time, you can exit bash using the exit command.
The Windows and WSL filesystems
WSL has its own filesystem. This Linux filesystem has been installed to your Windows filesystem at:
For instance, if your Windows username is Owner and Windows is installed on your C: drive, your WSL filesystem is located at:
It’s good to know that this is where it’s located, but you shouldn’t move this or make any changes to the files it contains.
When you’re using WSL, you might be wondering how you can access your Windows files. Your C: drive is located at:
The name mnt stands for “mount,” which is where your Windows drives are mounted within WSL. For instance, your D: drive would be /mnt/d/, etc.
Creating symbolic links to Windows folders
For convenience, it’s a good idea to create symbolic links to your Windows home folder. A symbolic link is similar to a shortcut in Windows: it’s a file that points to another file or directory. When you refer to the symbolic link, the system will dereference the link, and behave as if you had specified the actual “target” file or directory.
Using symbolic links can save you a lot of typing, and remembering of obscure directory names.
To create a symbolic link in Linux, use the ln command. The syntax for creating a symbolic link is ln -s targetname linkname.
For instance, to create a symbolic link in your WSL home folder called winhome that refers to C:UsersOwner, follow these steps.
First, change the working directory to your home directory, which is located at /home/username/. You can do this with the cd command:
In bash, “~” (a tilde) is an alias for your home directory, so you can also type:
Next, use ln -s to create the symbolic link. For instance, if your Windows home folder is C:UsersOwner, the command would be:
ln -s /mnt/c/Users/Owner/ winhome
Now there’s a symbolic link called winhome in your WSL home directory, which acts like a shortcut to your Windows home directory. So, you can change to your Windows home directory using:
Or, to change to your Windows desktop folder:
More information about Linux commands
Enjoy your new Linux subsystem! Make sure to check out our overview of Linux commands for more information about tools and programs you can use.