This guide walks you through installing and using Bash (the Linux command-line shell) on Windows 11 via the Windows Subsystem for Linux (WSL). By the end, you’ll be able to run Linux commands, install software, and script directly from your Windows PC. You’ll need Windows 11 (any edition) and administrative access to your computer.
What You’ll Need
- Windows 11 (64-bit, version 21H2 or later)
- Administrator rights on your PC
- Internet connection (to download WSL and the Linux distribution)
Step-by-Step
- Open PowerShell as Administrator – Right-click the Start button and select “Windows Terminal (Admin)” or “PowerShell (Admin)”. If prompted by User Account Control, click “Yes”.
- Enable WSL – In the terminal, run this command and press Enter:
wsl --install. This enables the required Windows features and installs the default Linux distribution (usually Ubuntu) automatically. - Restart your PC – After the command completes, you’ll be asked to restart. Save your work and restart.
- Set up your Linux username and password – After restart, a terminal window will open automatically to finish the installation. Enter a username (lowercase letters, no spaces) and a password (you won’t see characters as you type). This is separate from your Windows login.
- Verify Bash works – Type
bash --versionand press Enter. You should see version information. If not, close and reopen the terminal. - Access Bash anytime – Open the Start menu, type “Ubuntu” (or the distro you installed) and click it. Or open any terminal and type
wsl. - Install additional packages – Use the Linux package manager. For Ubuntu/Debian, run
sudo apt updatethensudo apt install <package-name>(e.g.,sudo apt install git).
Common Mistakes
- Not running as administrator – The
wsl --installcommand fails with “Access denied” if you don’t have admin rights. Always right-click and choose “Run as administrator”. - Skipping the restart – WSL won’t work until the required Windows features are enabled, which only takes effect after a reboot.
- Using the wrong package manager – If you installed a non-Ubuntu distro (e.g., Debian, Kali), commands like
aptmay not work. Use the distro’s package manager (e.g.,dnffor Fedora,pacmanfor Arch). - Confusing Windows paths with Linux paths – In Bash,
C:\Users\Nameis not valid. Use/mnt/c/Users/Nameto access Windows files. - Forgetting to update – New WSL installs often have outdated package lists. Run
sudo apt updatebefore installing anything.
Tips
- Set WSL 2 as default – WSL 2 offers better performance and full system call compatibility. Check with
wsl --set-default-version 2. - Access your Windows files – Your C: drive is mounted at
/mnt/c/. For example,cd /mnt/c/Users/YourName/Documents. - Use the same terminal for Windows and Linux – Windows Terminal lets you open multiple tabs, each with either PowerShell or Bash.
- Run a single Linux command from Windows – In PowerShell or CMD, type
wsl <command>(e.g.,wsl ls -la) to execute a Linux command without entering Bash. - Customize your prompt – Edit the
.bashrcfile in your home directory to change the prompt, add aliases, or set environment variables.
Troubleshooting
- “WSL is not installed” error – Run
wsl --installagain as administrator. If it still fails, enable the “Windows Subsystem for Linux” and “Virtual Machine Platform” features manually via “Turn Windows features on or off”, then restart. - “The operation timed out” during install – This is often a network issue. Check your internet connection, disable VPN or proxy, and try again. You can also download a distribution manually from the Microsoft Store.
- Bash opens but shows “command not found” for common tools – The package list is likely outdated. Run
sudo apt updateand thensudo apt upgrade. - WSL won’t start after a Windows update – Open PowerShell as admin and run
wsl --update. If that fails, restart your PC and try again. - “Please enable the Virtual Machine Platform” error – Go to “Turn Windows features on or off”, check “Virtual Machine Platform”, restart, then run
wsl --set-default-version 2.
Frequently Asked Questions
Is Bash the same as the Linux terminal?
Bash is a shell (command interpreter) that runs inside a terminal window. The terminal is the window itself; Bash is what processes your commands. On Windows, you get a terminal window that runs Bash via WSL.
Can I run graphical Linux apps with WSL?
Yes, WSL 2 supports GUI applications. Install a GUI app (e.g., sudo apt install gedit) and launch it from Bash. It will appear in a separate window, just like a native app.
How do I uninstall Bash/WSL?
Open PowerShell as admin and run wsl --unregister <DistroName> (e.g., wsl --unregister Ubuntu) to remove the distribution. To completely disable WSL, uncheck the Windows features or run wsl --install --no-distribution? Actually, use wsl --shutdown first, then uninstall via Settings > Apps.
Can I access my Windows files from Bash?
Yes, Windows drives are mounted under /mnt/. For example, ls /mnt/c/Users lists your Windows user folders. This works both ways – you can edit the same file from either Windows or Linux.
Do I need to enable Hyper-V?
No, WSL 2 uses a lightweight virtualization technology that doesn’t require the full Hyper-V feature. However, you must have “Virtual Machine Platform” enabled, which the wsl --install command does automatically.
What’s the difference between WSL 1 and WSL 2?
WSL 1 translates Linux system calls to Windows, while WSL 2 runs a real Linux kernel in a lightweight VM. WSL 2 offers better compatibility and performance for most tasks, but uses more memory. You can switch with wsl --set-version <Distro> 2.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Hiberfil.sys: What It Is & How to Delete It
- How to Make a Mask on Snapchat: Step-by-Step
- How to Factory Reset iPad If You Forgot Password
- Ubuntu in Windows Store: Which Editions Work?
- Secure Guest Account on Windows 11: Step-by-Step
- Stop Outlook From Changing Hyperlink Font