Running Unix on Windows 11 opens up a world of powerful tools for developers, students, and tech enthusiasts.
With Unix-like environments, you can execute commands like grep, awk, or bash right from your Windows PC.
Thanks to modern advancements, setting this up is easier than ever. In this guide, weโll walk you through installing a Unix-like system on Windows 11 using the Windows Subsystem for Linux (WSL), ensuring a seamless and beginner-friendly experience.
Step 1: Enable Windows Subsystem for Linux (WSL)
The easiest way to run a Unix-like environment on Windows 11 is through WSL, which lets you install Linux distributions like Ubuntu. Hereโs how to set it up:
- Open PowerShell as Administrator:
- Press Windows + S, type PowerShell, right-click it, and select Run as administrator.
- Install WSL:
- Type the command wsl โinstall and press Enter. This command automatically:
- Enables WSL and the Virtual Machine Platform.
- Downloads and installs the latest version of Ubuntu as the default Linux distribution.
- If you see a prompt to restart your PC, do so to complete the setup.
- Type the command wsl โinstall and press Enter. This command automatically:
- Verify Installation:
- After restarting, open PowerShell again and type wsl โlist or wsl -l. You should see Ubuntu listed as an installed distribution.
This single command simplifies what used to be a multi-step process, making WSL accessible to everyone.
Step 2: Set Up Your Linux Distribution
Once WSL is enabled, youโll need to configure your Unix-like environment:
- Launch Ubuntu:
- After the WSL installation, Ubuntu should automatically open in a terminal window. If not, search for Ubuntu in the Start menu and click it.
- Create a User Account:
- Ubuntu will prompt you to set a Unix username and password. These donโt need to match your Windows credentials.
- Example: Enter john as the username and create a secure password like MyPass123!.
- Note: The password wonโt display as you type for security reasonsโjust press Enter when done.
- Update the System:
- To ensure your Unix environment is current, run these commands in the Ubuntu terminal:
sudo apt update
sudo apt upgrade -y - sudo runs commands with elevated privileges, apt update refreshes package lists, and apt upgrade -y installs updates without prompting for confirmation.
- To ensure your Unix environment is current, run these commands in the Ubuntu terminal:
Step 3: Customize Your Unix Experience
To make your Unix environment more powerful, consider these enhancements:
Install a Different Linux Distribution
Ubuntu is great, but you might prefer another Unix-like system, such as Debian or Kali Linux. To install a different distribution:
- Open the Microsoft Store.
- Search for Linux, and choose a distribution like Debian or Kali Linux.
- Click Install, then launch it from the Start menu.
- Set it as the default by running wsl โset-default <distro-name> in PowerShell (e.g., wsl โset-default Debian).
Upgrade to WSL 2
WSL 2 offers better performance and full system call compatibility. To switch:
- In PowerShell (as administrator), type wsl โset-version <distro-name> 2 (e.g., wsl โset-version Ubuntu 2).
- If prompted, download the WSL 2 Linux kernel update from the
Install Windows Terminal
For a polished command-line experience, install Windows Terminal from the Microsoft Store. It lets you run multiple shells (PowerShell, Ubuntu, etc.) in tabs and supports customization like themes and fonts.
Step 4: Run Unix Commands and Tools
With your environment set up, you can start using Unix commands. Try these in your Ubuntu terminal:
- ls: Lists files in the current directory (similar to dir in Windows).
- cat filename: Displays the contents of a file.
- grep โpatternโ filename: Searches for text in files.
- man command: Shows help for a command (e.g., man ls).
To install additional tools, use:
- sudo apt install git for version control.
- sudo apt install python3 for Python development.
- sudo apt install vim for a powerful text editor.
You can access your Windows files from Linux at /mnt/c (e.g., cd /mnt/c/Users/YourUsername).
Step 5: Run Graphical Unix Applications (Optional)
Want to run Unix apps with a graphical interface, like GIMP or Firefox? WSL 2 supports GUI apps on Windows 11. Hereโs how:
- Ensure youโre using WSL 2 (check with wsl โlist โverbose).
- Install a graphical app, e.g., sudo apt install gimp.
- Launch it by typing gimp in the terminal. The app will appear on your Windows desktop.
If you encounter issues, install an X server like VcXsrv and configure it per the Microsoft WSL GUI guide.
Conclusion
Installing a Unix-like environment on Windows 11 with WSL is a game-changer for anyone wanting to blend the power of Unix with the familiarity of Windows.
By following these stepsโenabling WSL, setting up a Linux distribution, and customizing your setupโyouโll have a robust Unix environment ready for coding, scripting, or learning. Whether you stick with Ubuntu or explore other distributions, the possibilities are endless.