October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Bash

How to Use Linux Commands on Windows with WSL

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

The simplest way to use Linux commands on Windows is Windows Subsystem for Linux (WSL). WSL installs a Linux distribution, such as Ubuntu, alongside Windows so you can run Bash, GNU/Linux utilities, package managers and scripts without dual-booting or managing a traditional virtual machine. For a full session, open your installed distribution. For a single command, prefix it with wsl in PowerShell or Command Prompt.

This guide covers installation, command locations, Windows/Linux interoperability, WSL 1 versus WSL 2, filesystem choices, troubleshooting and an API alternative for developers who actually need website screenshots rather than a local Linux shell.

Check whether your PC can run WSL

Microsoft’s streamlined installer supports Windows 10 version 2004 (build 19041) or later, and Windows 11. Press Win+R, enter winver, and check the version and build number. If your system is older or the one-command installer fails, use Microsoft’s manual installation guidance instead of assuming the current path applies.

  • Administrator access is normally required for installation.
  • A Linux distribution must be installed and registered before distribution-specific commands or Linux filesystem paths will work.
  • Linux GUI applications require WSL 2 and Windows 10 build 19044 or later, or Windows 11; WSL GUI support is not a complete Linux desktop.

Install WSL and a Linux distribution

  1. Open PowerShell as administrator. Search for PowerShell, right-click it and choose Run as administrator.
  2. Run:
    wsl --install
  3. Restart Windows if prompted.
  4. Open Ubuntu from the Start menu. On its first launch, wait while the distribution finishes setup, then create a Linux username and password.

The command enables required Windows components, installs the current Linux kernel, sets WSL 2 as the default and installs Ubuntu by default. Microsoft documents this flow in Install WSL.

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

Install a different distribution

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

wsl --list --online

Install one using its exact listed name:

wsl --install -d <DistroName>

To see distributions already installed and their state, run:

wsl --list --verbose

Run Linux commands in an interactive shell

Launch Ubuntu (or your chosen distribution) from Start. You will see a Bash prompt. Commands such as these run inside Linux:

pwd
ls -la
cd /tmp
mkdir project
cp file.txt backup.txt
mv backup.txt archive.txt
rm archive.txt
cat /etc/os-release
uname -a

Use the distribution’s package manager to install tools. For Ubuntu, update package metadata and install a package with:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apt update
sudo apt install git curl

Your Linux home directory is represented by ~. Windows drives are mounted below /mnt; for example, C:UsersYourNameDocuments is commonly available as /mnt/c/Users/YourName/Documents.

Run one command from PowerShell or Command Prompt

You do not need to open a separate terminal for occasional commands. Prefix the Linux command with wsl:

wsl ls -la
wsl pwd
wsl cat /etc/os-release

Choose a particular installed distribution with -d:

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

The distribution name must exactly match the name shown by wsl --list --verbose. The -- separates WSL options from the command you want Linux to execute.

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.

Quote paths and arguments carefully

PowerShell, Command Prompt and Bash have different quoting and variable-expansion rules. If a path contains spaces, quote it for the shell that is parsing it. Test a simple command first, then add pipes, redirects or variables one stage at a time.

Mix Windows and Linux commands

Call Windows programs from Linux

WSL can launch Windows executables by adding .exe to the program name:

notepad.exe .bashrc
explorer.exe .

explorer.exe . opens the current Linux directory in File Explorer. Windows executables receive arguments through WSL’s interoperability layer, so paths and quoting still matter.

Use pipelines across environments

You can pipe Windows output into a Linux command, or filter Linux output with a Windows utility, but each shell’s syntax applies where that part of the pipeline runs. Start with explicit, small commands rather than assuming Bash syntax will behave identically in PowerShell.

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

Open a Linux directory in Windows

From Linux, explorer.exe . is the supported convenient route. Avoid editing Linux distribution files through arbitrary Windows paths or tools; use the Linux shell for Linux-owned files and the mounted /mnt/c tree for files that primarily belong to Windows.

WSL 1 or WSL 2?

WSL 2 uses an actual Linux kernel. Microsoft describes it as providing full system-call compatibility and improved filesystem performance relative to WSL 1, while WSL 1 uses a different architecture. The standard wsl --install path selects WSL 2.

That does not make one version universally faster. Your workload, especially where its files live, determines the result. Keep Linux-heavy projects in the distribution’s Linux filesystem and Windows-heavy projects in mounted Windows storage, then consult Microsoft’s current comparison guidance when a compatibility or performance requirement is decisive.

Inspect the version for each distribution:

wsl --list --verbose

Microsoft’s overview explains the architecture at What is Windows Subsystem for Linux.

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

Useful administration commands

wsl --status
wsl --version
wsl --list --online
wsl --list --verbose
wsl --shutdown
wsl --terminate <DistroName>
wsl --set-default <DistroName>
wsl --set-version <DistroName> 2

wsl --shutdown stops all running distributions and the WSL virtual machine. It is useful after configuration changes or when a process is stuck, but it also ends active Linux sessions.

Linux GUI applications on Windows

On supported installations, WSL 2 can run Linux GUI applications. Microsoft specifies Windows 10 build 19044 or later or Windows 11 for this capability. Install and launch the individual Linux application from your distribution; WSL provides the integration, not a full traditional Linux desktop environment. See Microsoft’s Linux GUI apps tutorial for the supported setup.

Troubleshooting common failures

“wsl” is not recognized

WSL is not installed, Windows is too old for the current path, or the shell has not refreshed after installation. Check winver, restart Windows, and follow the manual instructions at Microsoft’s installation page.

wsl --install shows help instead of installing

Use wsl --list --online, then install a named distribution with wsl --install -d <DistroName>. If the command still cannot install, use the manual path for your Windows build.

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

No distribution is installed

Run wsl --list --online and install Ubuntu or another listed distribution. A bare WSL feature without a registered distribution cannot provide a normal Linux prompt.

The selected distribution name fails

Names are exact. Copy the value shown by wsl --list --verbose and pass it to wsl -d; do not substitute a guessed version label.

Files are unexpectedly slow

Move Linux-intensive source trees and build outputs into the distribution’s Linux filesystem rather than repeatedly crossing between Linux and /mnt/c. For Windows-intensive tools, keeping files on the Windows filesystem may be more appropriate. There is no workload-independent winner.

A GUI app will not start

Confirm WSL 2 is in use, Windows meets the stated build requirement, and the application is installed inside the distribution. GUI support does not mean every desktop component or application is supported.

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

Interop commands fail

Verify that the target Windows executable exists and include .exe, for example notepad.exe. If WSL itself or its paths are unavailable, confirm that WSL and a distribution are installed first. Microsoft’s interop details are at WSL interoperability.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability and safety practices

  • Keep distributions and packages updated through their normal Linux package manager.
  • Use wsl --shutdown when a clean restart is needed instead of repeatedly killing individual processes.
  • Back up important Linux files; WSL is convenient but does not replace a backup strategy.
  • Be cautious with recursive commands such as rm -rf, especially when operating under /mnt/c.
  • Use the distribution terminal for sustained Bash scripts and wsl command for short Windows-side automation.

Microsoft’s command reference is maintained at Basic commands for WSL, and its environment guidance covers development workflows at Set up a WSL development environment.

Or skip the browser setup

If your actual goal is capturing a website rather than running local Linux utilities, ScreenshotNeo provides a website screenshot API and MCP server. One request returns PNG, JPEG, WebP or PDF. It accepts cookie banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing result. Its MCP tools—take_screenshot, get_page_info and capture_pdf—work with Claude, Cursor and other MCP clients.

See the full parameter reference in the ScreenshotNeo documentation. A direct cURL request is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

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)

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}`);

The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

Frequently Asked Questions

Can I use Bash without replacing Windows?

Yes. WSL runs a Linux environment alongside Windows without dual booting; open the installed distribution for a Bash session or use wsl command for one-off commands.

Does WSL install a full Linux desktop?

No. WSL provides Linux command-line environments, and supported WSL 2 setups can run individual Linux GUI apps, but it is not a complete Linux desktop installation.

Which distribution should beginners choose?

Ubuntu is the default installed by wsl --install and is a practical starting point. Other distributions can be installed by their exact names from wsl --list --online.

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.