Do you want to run Linux commands on your Windows 11 PC without installing a separate Linux system? Great! With Windows Subsystem for Linux (WSL), you can use Bash natively on Windows 11. In this guide, we’ll walk you through how-to-use-bash-on-windows-11-a-step-by-step-installation-guide from start to finish. We’ll cover installation, setup, tips, and common troubleshooting — all beginner-friendly and easy to follow.
Quick Summary — Key Takeaways
-
Bash is available on Windows 11 through WSL (Windows Subsystem for Linux).
-
You can install Linux distributions such as Ubuntu, Debian, Fedora, etc.
-
Enable WSL, install a Linux distro, and launch Bash using PowerShell or Windows Terminal.
-
Use Bash for Linux commands, scripting, and development directly in Windows.
-
Troubleshoot using WSL logs and commands if issues arise.
What Is Bash on Windows 11?
Bash is a command-line shell and scripting language commonly used in Linux and macOS. Windows 11 allows you to run Bash through Windows Subsystem for Linux (WSL).
With Bash on Windows:
-
Run Linux commands (
ls,grep,mkdir, etc.). -
Develop cross-platform software without leaving Windows.
-
Use Linux package managers like
aptto install tools. -
Run scripts and automation in a Linux environment.
Why Use Bash on Windows 11?
You might want Bash on Windows 11 if you:
-
Are a developer needing Linux tools without a virtual machine.
-
Want to run Bash scripts or shell commands.
-
Need to test Linux software on Windows.
-
Prefer the Linux command-line workflow for productivity.
System Requirements
Before you begin:
-
Windows 11 (64-bit) Build 22000 or later.
-
Administrator privileges to enable WSL.
-
Internet connection to download Linux distributions.
Step 1: Enable Windows Subsystem for Linux
There are two ways to enable WSL: via PowerShell (recommended) or through Windows Features.
Option A: Enable WSL via PowerShell
-
Press Win + X, then choose Windows Terminal (Admin) or PowerShell (Admin).
-
Run the following command:
-
This command will:
-
Enable WSL and required features.
-
Install the default Linux distro (Ubuntu).
-
Set WSL 2 as the default version.
-
-
Restart your computer if prompted.
Option B: Enable WSL via Windows Features
-
Press Win + R, type
optionalfeatures.exe, and press Enter. -
In Windows Features, check:
-
Windows Subsystem for Linux
-
Virtual Machine Platform
-
-
Click OK and restart your computer.
Step 2: Install a Linux Distribution
After enabling WSL, you need a Linux distro to run Bash.
Steps:
-
Open Microsoft Store.
-
Search for a Linux distro (Ubuntu is recommended for beginners).
-
Click Install.
-
Launch the distro from the Start menu.
On first launch:
-
Set a username and password for your Linux user account.
-
The shell prompt will appear, ready for Bash commands.
Step 3: Verify WSL and Bash
To check if WSL and Bash are working:
-
Open PowerShell or your Linux distro.
-
Run:
This shows installed distributions and WSL versions.
-
Run a simple Bash command:
You should see the contents of your Linux home directory.
Step 4: Update Linux Packages
It’s a good idea to update packages immediately:
This ensures all installed tools are up to date.
Step 5: Using Bash Commands on Windows 11
You can now run typical Linux commands:
-
File and directory management:
ls,cd,mkdir,rm -
File editing:
nano,vim -
Searching:
grep,find -
Installing software:
sudo apt install <package>
Example: Creating a new directory and file
Step 6: Accessing Windows Files from Bash
Your Windows files are accessible inside WSL under /mnt/:
-
C: drive →
/mnt/c/ -
D: drive →
/mnt/d/
Example:
Step 7: Customize Your Bash Experience
-
Use Windows Terminal for tabs, colors, and font customization.
-
Customize
.bashrcto set aliases, prompt colors, and environment variables. -
Install oh-my-zsh for a modern shell experience if you prefer Zsh.
Troubleshooting
Problem: WSL command not recognized
-
Make sure WSL is enabled.
-
Restart your PC after enabling WSL.
-
Run PowerShell as administrator.
Problem: Linux distro fails to install
-
Ensure Windows 11 Build >= 22000.
-
Check your internet connection.
-
Uninstall and reinstall the distro from Microsoft Store.
Problem: Cannot access Windows files
-
Use
/mnt/c/paths instead of Windows-styleC:\. -
Ensure your Linux user has correct permissions.
Tips for Efficient Bash Usage
-
Use Tab for auto-completion.
-
Use
historyto view previous commands. -
Pipe commands with
|for more complex operations. -
Combine Bash scripts with Windows files for hybrid workflows.
Conclusion
You now know how-to-use-bash-on-windows-11-a-step-by-step-installation-guide. With WSL, you can run Linux commands, develop software, and use Bash scripting directly in Windows 11 without dual boot or VM. Start by installing Ubuntu, try basic commands, and explore more advanced Linux tools as you grow. Bash on Windows unlocks a powerful development environment right on your PC.
FAQs
Q1: Can I install multiple Linux distributions?
Yes, you can install multiple distros and switch between them using wsl --list and wsl -d <distro> commands.
Q2: How do I check my WSL version?
Run wsl --list --verbose in PowerShell. WSL 2 is recommended.
Q3: Can I run GUI Linux apps?
Yes, WSLg allows Linux GUI apps to run natively on Windows 11.
Q4: How do I update WSL?
Run wsl --update in PowerShell as administrator.
Q5: Is Bash on Windows 11 safe?
Yes, it runs in a lightweight virtualized environment. Keep packages updated for security.
