Setting Up Linux on WSL (Windows Subsystem for Linux)#
If you’re using Windows but want a real Linux environment for development, learning, or experimenting, WSL (Windows Subsystem for Linux) is one of the easiest ways to get started.
It allows you to run a Linux distribution directly inside Windows — no reboot required.
What is WSL?#
WSL lets you run a full Linux user-space environment inside Windows. You can:
- Use the Linux terminal
- Install packages
- Compile programs
- Run tools like
git,gcc,python,node - Even run some GUI apps (WSLg)
Installing Linux on WSL#
Step 1: Install WSL#
Open PowerShell as Administrator and run:
wsl --install
This will: - Enable required Windows features - Download the Linux kernel - Install Ubuntu by default - Ask you to restart your system
Step 2: Set Up Your Linux User#
After rebooting:
- Ubuntu will launch automatically.
- Create a username.
- Set a password.
Now you are inside Linux.
Step 3: Update Your System#
Inside the Linux terminal, run:
sudo apt update
sudo apt upgrade -y
This ensures everything is up to date.
Alternative Ways to Install Linux#
WSL is convenient, but there are other options.
Virtual Machine (VM)#
You can install Linux using:
- VirtualBox
- VMware
Pros:#
- Full Linux system
- Safe testing environment
- Easy to remove
Cons:#
- Slower than WSL
- Uses more RAM and disk space
Dual Boot#
Install Linux alongside Windows on your computer.
Pros:#
- Full performance
- Direct hardware access
Cons:#
- Requires disk partitioning
- Must reboot to switch OS
- Risky if done incorrectly
Which Option Should You Choose?#
Use Case Recommended Option
Beginner learning Linux WSL Testing OS-level features VM Daily Linux user Dual Boot Development on Windows WSL
Basic Linux Terminal Commands#
Once you’re inside Linux, the terminal becomes your best friend.
Here are essential commands every beginner should know.
File and Directory Commands#
pwd#
Print working directory.
pwd
ls#
List files and directories.
ls
ls -l
ls -a
cd#
Change directory.
cd foldername
cd ..
cd ~
mkdir#
Create directory.
mkdir myfolder
rm#
Remove files or folders.
rm file.txt
rm -r foldername
Be careful. Deleting is permanent.
File Operations#
touch#
Create empty file.
touch file.txt
cat#
Display file content.
cat file.txt
nano#
Edit file in terminal.
nano file.txt
Package Management (Ubuntu/Debian)#
Install a package#
sudo apt install package_name
Example:
sudo apt install git
Remove a package#
sudo apt remove package_name
System Information Commands#
whoami#
whoami
uname -a#
uname -a
top#
top
Press q to quit.
Understanding sudo#
sud o means:
Super User DO
It gives administrative privileges.
Example:
sudo apt update
Final Thoughts#
WSL makes Linux accessible without leaving Windows. It’s perfect for developers, students, and beginners exploring Linux.
Use the terminal daily. Practice commands. Break things. Fix them. Learn.
Happy hacking.







