How To Execute Linux Commands In Windows | WSL Install Walkthrough

Running Linux commands on Windows is straightforward with Windows Subsystem for Linux (WSL), a free Microsoft tool that installs a full Linux environment in minutes.

Windows Subsystem for Linux (WSL) answers the question of how to execute Linux commands in Windows — a free Microsoft tool that deploys a full Ubuntu environment in about two minutes after a single command. No dual-boot partition required, no virtual machine software to manage. Just a native Linux kernel running inside Windows, accessible from your existing terminal or from its own dedicated window.

What Is WSL and Why Use It?

Windows Subsystem for Linux is a compatibility layer developed by Microsoft that runs a genuine Linux kernel inside Windows. Unlike traditional virtual machines that consume gigabytes of RAM and require separate desktop management, WSL integrates directly into the Windows file system and shares your machine’s resources with minimal overhead.

Developers choose WSL because it eliminates the friction of switching between operating systems. You can run bash scripts, use grep and sed, install packages with apt, and edit Linux files from VS Code — all without leaving Windows. Docker Desktop also requires WSL 2 for its Linux container engine, making it a prerequisite for modern container workflows. The environment is free for all Windows users and requires no subscription or enterprise license.

Running Linux Commands on Windows: What You Need Before Setup

WSL runs on any modern Windows machine that meets three requirements. Check these before running the installation command.

  • Operating system: Windows 10 version 20H4 or later, or Windows 11 version 22H2 or later. Older versions like Windows 7 and 8 are not supported.
  • Virtualization enabled: Intel VT-x or AMD-V must be active in your system’s BIOS or UEFI. Most PCs from 2015 onward have this setting turned on by default, but some firmware configurations disable it.
  • Administrator access: The installation command requires running PowerShell or Command Prompt as an administrator.

If your system meets these three conditions, you are ready for the single-command install.

How Do You Install WSL on Windows?

Microsoft designed the current WSL installation to complete in one command. Open PowerShell or Command Prompt as administrator — press the Windows key, type PowerShell, right-click the result, and select Run as administrator. Then enter this command and press Enter:

wsl --install

This single command handles everything automatically:

  • Enables the Windows Subsystem for Linux feature.
  • Enables the Virtual Machine Platform feature.
  • Downloads and installs the WSL 2 kernel.
  • Installs Ubuntu 24.04 LTS as the default Linux distribution.

The process takes one to three minutes depending on your internet speed. After it finishes, you are prompted to restart your computer — do not skip this step.

Once rebooted, open Ubuntu from the Start Menu. A terminal window opens and asks you to create a Unix username and password. This account is a standard (non-root) user, which is the recommended security practice for daily work. When the prompt appears and the installation completes, you will see the standard Ubuntu command line — that is the success cue that WSL is ready.

To verify the installation, run this command in PowerShell or Command Prompt:

wsl --list --verbose

You should see Ubuntu 24.04 LTS listed with a version of 2. That confirmation means WSL 2 is active and ready to accept Linux commands.

Alternative: Manual WSL Installation

If the automatic install fails or you are on Windows 10, the manual route works just as reliably. Open Control Panel, navigate to Programs > Turn Windows features on or off, and check both Windows Subsystem for Linux and Virtual Machine Platform. Click OK, restart, then open the Microsoft Store, search for Ubuntu LTS 24.04, and click Install. Launch the distribution from the Start Menu after installation completes, create your user account, and the terminal will open to a working bash prompt.

WSL 1 vs WSL 2: Which Version Runs Your Commands?

WSL 2 is the current default and recommended version for nearly all use cases. WSL 1 remains available for systems where virtualization is unavailable or for users who need faster access to the Windows file system without the performance trade-offs of the virtual disk.

Feature WSL 1 WSL 2
Architecture Translation layer (syscall emulation) Full Linux kernel in a lightweight VM
Linux kernel None (syscalls translated to Windows) Genuine Linux kernel (Microsoft-built)
File system performance Fast on Windows drives (NTFS) Fast on Linux drives (ext4); slower on Windows drives
RAM overhead Low (~200 MB base) Moderate (~1 GB base, configurable)
Docker support Not compatible Required for Docker Desktop
GUI application support Requires third-party X server WSLg built in (Windows 11 22H2+)
Best for Systems without virtualization General development and container work

Run wsl --set-version Ubuntu 2 in PowerShell to upgrade an existing WSL 1 distribution to WSL 2. The official Microsoft installation documentation covers every flag, edge case, and configuration option for the wsl command. Microsoft’s WSL installation guide includes troubleshooting steps for common errors and advanced setup scenarios.

Common Mistakes That Break WSL Setup

Most installation failures come from one of four oversights. Skipping the restart after enabling Windows features causes virtual machine platform errors. Running the install command without administrator privileges fails silently. Disabled virtualization in BIOS produces the “no virtualization platform found” error when WSL 2 tries to start. And creating a root user instead of a standard Unix account during initial setup violates Microsoft’s security guidance and can cause permission issues later.

If you see an error about virtualization, reboot into your system’s BIOS or UEFI — usually by pressing F2, Del, or F10 during startup — and look for an option labeled Intel VT-x, AMD-V, SVM Mode, or Virtualization Technology. Enable it, save the settings, and restart Windows.

Performance and Safety Considerations

WSL 2 uses approximately 1 GB of RAM at idle and can consume more under load. You can limit this by creating a .wslconfig file in your Windows user directory with a memory cap such as memory=4GB. Linux files reside in a virtual hard disk at ext4.vhdx and are accessible from Windows at \\wsl$\Ubuntu. Do not modify these files directly from Windows — use the Linux command line instead to avoid file corruption.

WSL is isolated from the Windows host by default, but mounting Windows drives inside the Linux environment at /mnt/c exposes those files to Linux commands. Running rm -rf on a mounted Windows directory will delete Windows files permanently. Treat mounted drives with the same caution you would on a native Linux machine.

Essential Linux Commands to Try After Setup

Once your Ubuntu terminal is running, these commands confirm the environment works and show how Linux differs from PowerShell or Command Prompt. Each command below is a standard Linux tool that behaves identically on WSL and a native Ubuntu installation.

Command What It Does Try This
ls Lists files and directories in the current folder ls -la (shows hidden files and details)
pwd Prints the current working directory path pwd (shows /home/yourname at login)
cd Changes the current directory cd /mnt/c/Users (reaches Windows user folders)
mkdir Creates a new directory mkdir projects (makes a folder in your home dir)
apt update Refreshes the package list from Ubuntu repositories sudo apt update && sudo apt upgrade
grep Searches text for matching patterns grep "error" logfile.txt

The success cue for each command is the same: you see output on the terminal without an error message. If a command returns nothing, it likely executed correctly — many Linux tools produce output only when something is wrong.

Running Linux Commands From Any Windows Terminal

You do not need to open the Ubuntu app every time. Any Windows terminal — PowerShell, Command Prompt, or Windows Terminal — can run Linux commands by prefixing them with wsl. Typing wsl ls -la in PowerShell runs the Linux ls command and returns output directly in the PowerShell window. This makes it possible to pipe Linux commands into Windows tools and vice versa.

For a dedicated Linux workspace, Windows Terminal from the Microsoft Store provides a tabbed interface with profiles for PowerShell, Command Prompt, and WSL in a single window. After installation, WSL appears as an available profile that launches directly into your Ubuntu shell.

First-Day Sequence: Confirm Everything Works

Run through this sequence to verify your WSL environment is fully operational:

  1. Open PowerShell as administrator and run wsl --install.
  2. Restart your computer when prompted.
  3. Launch Ubuntu from the Start Menu and create your Unix username and password.
  4. Run wsl --list --verbose to confirm WSL 2 is active.
  5. Type ls ~ to see your Linux home directory.
  6. Run sudo apt update && sudo apt upgrade to install the latest Ubuntu packages.
  7. Type wsl in PowerShell to verify cross-terminal execution works.

When each step completes without errors, you have a fully functional Linux environment inside Windows. The Ubuntu terminal now accepts any standard Linux command you would run on a server or desktop Linux system.

References & Sources

Please use a real email you check. If it's fake or mistyped, your message won't reach us and we can't reply — wrong addresses are rejected automatically.