Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The standard way to use Linux commands on Windows is Windows Subsystem for Linux (WSL). WSL runs a Linux distribution such as Ubuntu beside Windows, so you can use Bash, GNU utilities, package managers and scripts without dual-booting or installing a traditional virtual machine. For a complete shell, open your installed distribution. For an occasional command from PowerShell or Command Prompt, prefix it with wsl.

What WSL gives you

Microsoft describes WSL as a Windows feature that runs a Linux environment without a separate virtual machine or dual boot: Microsoft’s WSL overview. You install a distribution, then work at its shell prompt with commands such as ls, grep, find, sed, awk, ssh, Git and language toolchains.

  • A full Bash session and Linux home directory.
  • Linux package managers and command-line applications.
  • Access to Windows files and Windows executables.
  • One-off Linux commands launched from Windows shells.
  • Linux GUI applications on supported Windows builds and WSL 2, but not a complete Linux desktop.

WSL 2 is the normal choice on current installations. It uses an actual Linux kernel and provides broader system-call compatibility than WSL 1. Filesystem performance depends on the workload and where files are stored, so use Microsoft’s current guidance when choosing between versions rather than assuming one is faster for every project.

Check your Windows version and prerequisites

The streamlined installation command requires Windows 10 version 2004 (build 19041) or later, or Windows 11. Press Win+R, enter winver, and check the version and build. If your system is older or your organization blocks the automated path, follow Microsoft’s manual installation instructions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You need administrator access for the initial setup and a restart may be required. After installation, you also need at least one registered Linux distribution before commands such as wsl ls or WSL filesystem paths can work reliably.

Install WSL and Ubuntu

  1. Open PowerShell as administrator. Search for PowerShell, right-click it, and select Run as administrator.
  2. Run:
wsl --install

This command enables required Windows components, installs the latest Linux kernel, sets WSL 2 as the default, and installs Ubuntu by default. Restart when Windows asks you to.

  1. After restarting, launch Ubuntu from the Start menu. The first launch completes distribution setup.
  2. Choose a Linux username and password. This account is separate from your Windows account; the password is used for commands with sudo.
  3. Update the distribution:
sudo apt update
sudo apt upgrade

If wsl --install only displays help because WSL is already present, list available distributions and install one explicitly:

wsl --list --online
wsl --install -d <DistroName>

Replace <DistroName> with the exact name shown by the list. To see distributions already installed, use wsl --list --verbose. The installed name matters when selecting a distribution later.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run commands in a Linux terminal

Use an interactive Bash session

Open Ubuntu (or another installed distribution) from the Start menu. You will see a prompt similar to name@computer:~$. Commands run in Linux until you type exit or close the window.

pwd
ls -la
mkdir -p ~/demo
cd ~/demo
echo "Hello from WSL" > message.txt
cat message.txt
grep Hello message.txt

Install tools with the distribution’s package manager. On Ubuntu, for example:

sudo apt update
sudo apt install git curl build-essential

Linux paths use forward slashes and are case-sensitive. Your Linux home directory is normally /home/<username>.

Launch a one-off command from PowerShell or Command Prompt

Open PowerShell or Command Prompt and prefix the Linux command with wsl:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
wsl ls -la
wsl pwd
wsl grep -R "TODO" .

By default, the command uses the default distribution. Select a particular installed distribution with:

wsl -d Ubuntu-22.04 -- cat /etc/os-release

Use the exact distribution name returned by wsl --list --verbose. The -- marks the end of WSL options and makes the command boundary clear.

Move between Windows and Linux files

Open Windows files from Linux

Windows drives appear under /mnt. For example, your Windows Downloads folder is commonly:

cd /mnt/c/Users/YourWindowsName/Downloads
ls

Replace the user name with your actual Windows profile. Keep Linux projects inside the Linux filesystem (for example, under ~/projects) when Linux tools perform intensive file operations; use /mnt/c when convenient access from Windows is more important.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Open Linux files from Windows

From a WSL prompt, open the current directory in File Explorer:

explorer.exe .

Windows can also browse a running distribution through the WSL network location in File Explorer. Avoid editing distribution files directly inside WSL’s virtual-disk storage with low-level Windows tools; use Explorer integration or commands inside WSL instead.

Run Windows programs from Linux

WSL can invoke Windows executables by adding .exe:

notepad.exe .bashrc
explorer.exe .

Windows programs receive arguments using Windows conventions, so quote paths containing spaces and be deliberate when mixing Linux and Windows path formats. Microsoft documents this integration in WSL interoperability guidance.

Combine Windows and Linux commands

You can call WSL from PowerShell pipelines, but quoting and pipeline behavior differ between shells. A simple example sends text to a Linux filter:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
"one`ntwo`nthree" | wsl grep two

Conversely, run a Windows filter on Linux-generated output from a Windows shell:

wsl printf "alphanbetan" | findstr beta

For complex scripts, put the logic in a Bash script and run it in the distribution rather than relying on several layers of shell quoting.

Choose between an interactive shell and wsl <command>

Need Best approach Why
Several commands, variables, loops or a Bash script Open Ubuntu or another distribution You remain in one Linux shell with normal Bash behavior.
A single Linux utility from a Windows workflow Run wsl <command> No separate terminal session is needed.
A specific distribution wsl -d Name -- command Prevents the command from running in the wrong installed distribution.
Windows and Linux tools in one pipeline Use explicit wsl boundaries and test quoting Each shell parses metacharacters differently.

WSL 1 versus WSL 2

WSL 1 and WSL 2 are different architectures. WSL 2 uses a Linux kernel and is the default selected by current wsl --install. Microsoft says WSL 2 improves filesystem performance and provides full system-call compatibility relative to WSL 1, but the best choice still depends on your workload, especially whether files live in the Linux filesystem or a mounted Windows drive.

Inspect the version used by each distribution:

wsl --list --verbose

Set a distribution to version 2 when supported:

wsl --set-version <DistroName> 2

Do not interrupt conversion while it is running. Check Microsoft’s comparison documentation linked from the WSL overview before changing a production or large development environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Linux GUI applications

Linux GUI app support requires WSL 2 and Windows 11, or Windows 10 build 19044 or later, according to Microsoft’s GUI application guidance. It lets supported Linux graphical apps appear alongside Windows apps; it is not a full Linux desktop environment. Command-line work does not require GUI support.

Common errors and fixes

wsl is not recognized

Confirm the Windows version with winver, install pending Windows updates, and run the installation procedure from an elevated PowerShell window. On older releases, use Microsoft’s manual instructions rather than forcing the current command.

There is no distribution

Run:

wsl --list --online
wsl --install -d Ubuntu

Then launch the distribution once to finish its first-run setup.

The wrong distribution runs

List exact names with wsl --list --verbose, then specify one:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
wsl -d Ubuntu -- bash -lc 'uname -a'

Set a preferred default with wsl --set-default <DistroName>.

A Linux command works in Ubuntu but not with wsl

The command may be running in another distribution, or the program may not be installed there. Use wsl -d Name -- command, then install the package inside that distribution.

Permission denied

Check ownership and mode with ls -l. Use sudo only for administrative operations, and avoid changing permissions broadly on mounted Windows folders. A Linux process cannot automatically use every Windows administrator permission.

Quoting or paths break in a pipeline

PowerShell, Command Prompt and Bash each interpret quotes, variables and wildcards differently. Start with a simple command, quote arguments at the shell where they are parsed, and move multi-step logic into a script inside WSL.

Commands are slow when working under /mnt/c

Test the same operation in your Linux home directory. For Linux-heavy builds, dependency trees and source-control operations, storing the project under ~/ can avoid cross-filesystem overhead; keep a Windows-side copy or use Explorer integration when Windows applications need direct access.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Operational tips

  • Update packages regularly with your distribution’s package manager.
  • Use wsl --shutdown to stop all running distributions when troubleshooting resource use or after changing configuration.
  • Keep scripts reproducible: record package names, distribution versions and required environment variables.
  • Do not assume /mnt/c paths, Linux home paths and Windows paths can be substituted without conversion.
  • WSL is not a security boundary. Treat downloaded scripts and commands with the same caution as native Windows software.

Or skip the browser setup

If your Linux workflow also needs website screenshots—for example, a Bash script that captures a deployment preview—you can call ScreenshotNeo instead of installing and maintaining a browser automation stack. Its API accepts a URL and returns PNG, JPEG, WebP or PDF. Before capture it accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing result.

See the parameter reference in the ScreenshotNeo documentation. A Bash call from WSL is:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

The same request in Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

And in Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. Features include full-page lazy-image loading, CSS-selector element capture, dark mode, device presets, custom viewports, retina scale, PDF controls, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agents, authorization, timezone and geolocation, transparent backgrounds, resizing, configurable caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data and an OpenAPI specification. Every feature is included on every plan. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up free for ScreenshotNeo.

FAQ

Can I use Linux commands without installing Ubuntu?

You need a registered WSL distribution to run Linux commands. Ubuntu is the default, but you can install another distribution listed by wsl --list --online.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does WSL replace Windows?

No. WSL runs alongside Windows and lets you invoke programs from both environments.

Is WSL a full virtual machine?

WSL provides a Linux environment integrated with Windows. WSL 2 uses a Linux kernel, but its workflow and integration differ from managing a traditional virtual machine.

Can WSL run graphical Linux software?

Supported GUI apps require WSL 2 and Windows 11 or Windows 10 build 19044 or later; this does not provide a complete Linux desktop.

Frequently Asked Questions

Can I use Linux commands without installing Ubuntu?

You need a registered WSL distribution to run Linux commands. Ubuntu is the default, but you can install another distribution listed by wsl --list --online.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does WSL replace Windows?

No. WSL runs alongside Windows and lets you invoke programs from both environments.

Is WSL a full virtual machine?

WSL provides a Linux environment integrated with Windows. WSL 2 uses a Linux kernel, but its workflow and integration differ from managing a traditional virtual machine.

Can WSL run graphical Linux software?

Supported GUI apps require WSL 2 and Windows 11 or Windows 10 build 19044 or later; this does not provide a complete Linux desktop.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.