wsl --install -d -uBuntu
If youβre looking to get a Linux environment running on your Windows machine, wsl --install -d Ubuntu is essentially the "Easy Button."
Here is a breakdown of what that command actually does, why itβs structured that way, and what happens once you hit Enter.
1. Deconstructing the Command
The command is composed of three specific parts that tell Windows exactly how to set up your environment:
wsl: This invokes the Windows Subsystem for Linux executable.--install: This is the primary flag that tells Windows to enable the necessary optional features (like Virtual Machine Platform) and install the WSL GUI App support.-d Ubuntu: The-dstands for Distribution. This specifies that instead of installing the default version, you want the latest stable release of Ubuntu.
2. What Happens Behind the Scenes?
When you run this command in an Administrator PowerShell or Command Prompt, Windows performs several heavy-lifting tasks:
- Enables WSL Features: It toggles the Windows features "Windows Subsystem for Linux" and "Virtual Machine Platform" to "On."
- Downloads the Linux Kernel: It fetches the latest Microsoft-built Linux kernel.
- Sets WSL 2 as Default: It ensures you are using the modern utility that runs on a lightweight utility VM (offering much faster file system performance than the original WSL 1).
- Downloads & Extracts Ubuntu: It pulls the Ubuntu root filesystem from the Microsoft Store/online servers and registers it as a runnable "distro."
3. The Installation Process
To use this command effectively, follow these steps:
Prerequisites
- Windows 10 (version 2004 and higher) or Windows 11.
- Administrator Privileges: You must run your terminal as an Administrator.
The Workflow
- Run the Command: Open PowerShell (Admin) and type
wsl --install -d Ubuntu. - Restart: If this is your first time enabling WSL, Windows will prompt you to restart your computer to finalize the virtual machine features.
- User Setup: After restarting, a new Ubuntu terminal window will open automatically. It will ask you to:
- Create a Username: This is specific to Linux; it doesn't have to match your Windows name.
- Set a Password: Note that the cursor won't move while you type your password (this is a standard Linux security feature).
4. Why use Ubuntu?
While WSL supports many distributions (Debian, Kali, openSUSE, etc.), Ubuntu is the most popular choice because:
- Massive Documentation: Almost every Linux tutorial on the internet works for Ubuntu.
- Package Management: It uses
apt, which is incredibly user-friendly for installing software. - Compatibility: Itβs the industry standard for cloud development and many DevOps tools.
5. Helpful Post-Install Commands
Once you have Ubuntu installed, here are the first three things you should do:
| Command | Purpose |
|---|---|
sudo apt update && sudo apt upgrade |
Updates all pre-installed software to the latest versions. |
wsl --list --verbose |
Run this in Windows to confirm Ubuntu is running on version 2. |
explorer.exe . |
Run this inside Ubuntu to open your Linux files in the Windows File Explorer. |
Pro Tip: If you want to see which other distributions are available to install, you can run
wsl --list --online.