{"id":11058,"date":"2026-05-13T10:28:47","date_gmt":"2026-05-13T10:28:47","guid":{"rendered":"https:\/\/commandlinux.com\/?p=11058"},"modified":"2026-05-13T10:28:49","modified_gmt":"2026-05-13T10:28:49","slug":"wsl","status":"publish","type":"post","link":"https:\/\/commandlinux.com\/qa\/wsl\/","title":{"rendered":"How to Set Up and Use WSL on a Windows PC"},"content":{"rendered":"\n<link href=\"https:\/\/fonts.googleapis.com\/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600;8..60,700&#038;display=swap\" rel=\"stylesheet\">\n\n<style>\n    .wsl-article a {\n        color: #1a5276;\n        text-decoration: underline;\n    }\n    .wsl-article a:hover {\n        color: #0d3b56;\n    }\n    .wsl-article code {\n        background: #f4f4f4;\n        padding: 2px 7px;\n        border-radius: 4px;\n        font-family: 'Courier New', monospace;\n        font-size: 15px;\n    }\n    .wsl-article pre {\n        background: #f4f4f4;\n        padding: 16px 20px;\n        border-radius: 6px;\n        overflow-x: auto;\n        margin: 14px 0 18px 0;\n    }\n    .wsl-article pre code {\n        background: none;\n        padding: 0;\n        font-size: 15px;\n    }\n    .wsl-article table {\n        width: 100%;\n        border-collapse: collapse;\n        margin: 18px 0 22px 0;\n    }\n    .wsl-article th {\n        background: #f7f7f7;\n        text-align: left;\n        padding: 10px 14px;\n        font-weight: 600;\n        border-bottom: 2px solid #ddd;\n        font-size: 15px;\n    }\n    .wsl-article td {\n        padding: 10px 14px;\n        border-bottom: 1px solid #eee;\n        font-size: 15px;\n    }\n    .wsl-article .faq-section h3 {\n        font-size: 19px;\n        margin: 22px 0 8px 0;\n    }\n<\/style>\n\n<div class=\"wsl-article\">\n\n<p>Running Linux tools on a Windows machine used to mean dual booting or setting up a virtual machine. Both eat into disk space and slow things down. WSL \u2014 Windows Subsystem for Linux \u2014 removes that friction entirely. It runs a real Linux terminal inside Windows, no rebooting required, no separate partition needed.<\/p>\n\n<h2>What Is WSL (Windows Subsystem for Linux)?<\/h2>\n\n<p>WSL is a compatibility layer built by Microsoft that lets Windows PCs execute Linux binaries, shell scripts, and command-line programs without a virtual machine or emulator. It ships with Windows 10 (version 2004+) and Windows 11.<\/p>\n\n<p>You can run distributions like Ubuntu, Debian, Kali, Fedora, and Arch directly from your Windows desktop. Each distro operates through its own terminal session and maintains a separate file system, though files are shared between both operating systems.<\/p>\n\n<p>WSL 2, the current version, uses an actual Linux kernel instead of a translation layer. File system performance is noticeably faster, and compatibility with Linux programs is near-complete.<\/p>\n\n<h2>How to Install WSL on Windows<\/h2>\n\n<h3>Check System Requirements<\/h3>\n\n<p>Your machine needs an x64 or ARM64 processor running Windows 10 build 19041 or later. Open System Information from the Start menu and confirm your OS build number and system type. On physical hardware, virtualization must be enabled in BIOS \u2014 the exact setting varies by manufacturer.<\/p>\n\n<h3>Enable the WSL Feature<\/h3>\n\n<p>Search for &#8220;Windows Features&#8221; in the Start menu. A dialog box lists optional components. Find &#8220;Windows Subsystem for Linux&#8221; in that list, check it, and click OK. The system will prompt a restart.<\/p>\n\n<h3>Run the Install Command<\/h3>\n\n<p>Open PowerShell as administrator and type:<\/p>\n\n<pre><code>wsl --install<\/code><\/pre>\n\n<p>This single command downloads the WSL components, enables the Virtual Machine Platform, and installs Ubuntu by default. On recent builds of Windows 11, it handles every prerequisite automatically \u2014 no extra steps.<\/p>\n\n<h3>Choose a Different Linux Distribution<\/h3>\n\n<p>If you&#8217;d rather use something other than Ubuntu, list what&#8217;s available:<\/p>\n\n<pre><code>wsl --list --online<\/code><\/pre>\n\n<p>Then install your pick with:<\/p>\n\n<pre><code>wsl --install -d &lt;DistroName&gt;<\/code><\/pre>\n\n<p>Debian, openSUSE, Kali, and Arch are all free through the Microsoft Store as well.<\/p>\n\n<h3>Set Up Your Linux Username and Password<\/h3>\n\n<p>After installation, open the distro from the Start menu. The first launch asks you to create a Unix username and password. This account is separate from your Windows login. Once you set it, you land at a <a href=\"https:\/\/commandlinux.com\/man-page\/man1\/bash\">Bash shell<\/a> prompt, ready to go.<\/p>\n\n<h2>WSL Configuration and Useful Commands<\/h2>\n\n<p>A few commands worth knowing right away:<\/p>\n\n<table>\n<tr><th>Command<\/th><th>What It Does<\/th><\/tr>\n<tr><td><code>wsl --list --verbose<\/code><\/td><td>Shows installed distros and their WSL version<\/td><\/tr>\n<tr><td><code>wsl --set-default &lt;Distro&gt;<\/code><\/td><td>Changes your default distribution<\/td><\/tr>\n<tr><td><code>wsl --shutdown<\/code><\/td><td>Stops all running WSL instances<\/td><\/tr>\n<tr><td><code>wsl --update<\/code><\/td><td>Updates the WSL kernel to the latest build<\/td><\/tr>\n<\/table>\n\n<p>WSL stores its own directory tree on disk. You can access Windows files from Linux at <code>\/mnt\/c\/<\/code>, and browse the Linux file system from Windows Explorer by typing <code>\\\\wsl$<\/code> in the address bar. Operations like <a href=\"https:\/\/commandlinux.com\/qa\/linux-copy-file\/\">copying files between both systems<\/a> work without any extra configuration.<\/p>\n\n<h2>Setting Up a WSL Development Environment<\/h2>\n\n<p>After the initial install, most developers update packages first. On Ubuntu or Debian, that&#8217;s:<\/p>\n\n<pre><code>sudo apt update && sudo apt upgrade<\/code><\/pre>\n\n<p>The <a href=\"https:\/\/commandlinux.com\/man-page\/man8\/apt\/\">apt package manager<\/a> handles all software installation from here. If you run into issues with missing packages, the guide to <a href=\"https:\/\/commandlinux.com\/how-to\/apt-get-command-not-found\/\">fixing the apt-get command not found error<\/a> covers the common causes.<\/p>\n\n<p>Windows Terminal (free from the Microsoft Store) is the recommended way to manage your sessions. It supports tabs, so you can run PowerShell, Command Prompt, and multiple WSL distros side by side without opening separate windows.<\/p>\n\n<p>VS Code integrates directly with WSL. Install it on Windows, and the Remote &#8211; WSL extension lets you edit and debug code inside the Linux file system as if it were local. No manual SSH setup required.<\/p>\n\n<h2>Common WSL Use Cases<\/h2>\n\n<table>\n<tr><th>Use Case<\/th><th>How WSL Fits<\/th><\/tr>\n<tr><td>Web development<\/td><td>Run Node.js, Python, or PHP servers locally in a Linux environment that mirrors production<\/td><\/tr>\n<tr><td>DevOps and automation<\/td><td>Test shell scripts, Docker containers, and CI pipelines without leaving Windows<\/td><\/tr>\n<tr><td>Security work<\/td><td>Load Kali Linux and run network scans or vulnerability assessments with native tools<\/td><\/tr>\n<tr><td>Academic work<\/td><td>Practice terminal commands, <a href=\"https:\/\/commandlinux.com\/how-to\/chmod-executable\/\">file permissions<\/a>, and shell scripting without dedicated hardware<\/td><\/tr>\n<\/table>\n\n<p>Developers who need to <a href=\"https:\/\/commandlinux.com\/how-to\/apt-install-specific-version\/\">install specific package versions<\/a> for dependency management can do so inside WSL without touching the Windows environment at all.<\/p>\n\n<h2>Tips for Getting More Out of WSL<\/h2>\n\n<p>Edit <code>~\/.bashrc<\/code> to define aliases, custom prompts, and environment variables. Small tweaks here \u2014 like shortening frequently typed paths \u2014 add up over time. The <a href=\"https:\/\/commandlinux.com\/man-page\/man1\/man\">man command<\/a> is available for any Linux utility you&#8217;re unfamiliar with.<\/p>\n\n<p>WSL also lets you call Windows executables from the Linux terminal. Running <code>explorer.exe .<\/code> from a WSL session opens the current directory in Windows File Explorer. Going the other direction, you can pipe output from Linux commands into Windows programs or scripts.<\/p>\n\n<p>For resource management, create a <code>.wslconfig<\/code> file at <code>C:\\Users\\&lt;YourUsername&gt;\\.wslconfig<\/code> to cap memory usage and processor count. WSL 2 runs a lightweight VM under the hood, and these limits prevent it from consuming more than your workload actually needs.<\/p>\n\n<h2 class=\"faq-section\">FAQs<\/h2>\n\n<h3>Is WSL free to use on Windows?<\/h3>\n<p>Yes. WSL is a built-in Windows feature available at no cost on Windows 10 (version 2004+) and Windows 11. Linux distributions in the Microsoft Store are also free.<\/p>\n\n<h3>Can WSL run GUI Linux applications?<\/h3>\n<p>WSL 2 on Windows 11 supports Linux GUI apps natively through WSLg. On Windows 10, you need a third-party X server like VcXsrv to display graphical programs.<\/p>\n\n<h3>Does WSL replace a virtual machine?<\/h3>\n<p>For most command-line and development tasks, yes. WSL uses fewer resources than a full VM. It does not replicate an entire Linux desktop environment, though.<\/p>\n\n<h3>Can I run Docker inside WSL?<\/h3>\n<p>Yes. Docker Desktop for Windows integrates with WSL 2 directly. Containers run inside the WSL backend with near-native Linux performance.<\/p>\n\n<h3>How do I uninstall a WSL distribution?<\/h3>\n<p>Run <code>wsl --unregister &lt;DistroName&gt;<\/code> in PowerShell. This removes the distro and all its data. You can reinstall it from the Microsoft Store afterward.<\/p>\n\n<\/div>\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>Run Linux tools directly on Windows with WSL (Windows Subsystem for Linux) \u2014 no dual boot, virtual machine, or reboot required. Get a real Linux terminal experience without sacrificing disk space or system performance.<\/p>\n","protected":false},"author":1,"featured_media":11059,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"class_list":["post-11058","post","type-post","status-publish","format-standard","has-post-thumbnail","category-qa"],"_links":{"self":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts\/11058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/comments?post=11058"}],"version-history":[{"count":1,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts\/11058\/revisions"}],"predecessor-version":[{"id":11060,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts\/11058\/revisions\/11060"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/media\/11059"}],"wp:attachment":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/media?parent=11058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/categories?post=11058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/tags?post=11058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}