Skip to content

Instantly share code, notes, and snippets.

@suhailroushan13
Last active August 3, 2026 18:25
Show Gist options
  • Select an option

  • Save suhailroushan13/18536695419546dcc0413211e0ea4ac6 to your computer and use it in GitHub Desktop.

Select an option

Save suhailroushan13/18536695419546dcc0413211e0ea4ac6 to your computer and use it in GitHub Desktop.
Setting Up WSL

WSL (Windows Subsystem for Linux) – Complete Beginner Guide

This guide is written for complete beginners who have never used Linux before.


What is WSL?

WSL (Windows Subsystem for Linux) allows you to run a real Linux operating system inside Windows without installing a virtual machine or dual booting.

It gives Windows users access to Linux commands, programming tools, package managers, Node.js, Git, Docker, Python, C/C++, and many other developer tools.


Why Do Developers Use Linux?

Linux is the most popular operating system among software developers.

1. Open Source

Anyone can view, modify, and improve Linux because its source code is publicly available.


2. Free of Cost

Unlike many commercial operating systems, Linux is completely free.


3. Full Control

Linux gives you complete control over your computer.

  • Install only what you need
  • Customize everything
  • Better performance
  • Better security

4. Huge Developer Community

Millions of developers use Linux.

Whenever you face an error, chances are someone has already solved it.

Useful websites:

  • Stack Overflow
  • GitHub
  • Reddit
  • Linux Documentation

5. Used Everywhere

Linux powers

  • Google
  • Amazon AWS
  • Facebook
  • Netflix
  • Android
  • Super Computers
  • Servers
  • Cloud Infrastructure

Learning Linux is almost mandatory for modern software development.


Linux Distributions (Distros)

Linux is the parent operating system.

Different organizations create their own versions called Distributions (Distros).

Popular ones include:

Distro Mostly Used For
Ubuntu Web Development
Kali Linux Cyber Security & Penetration Testing
Fedora Desktop & Enterprise Development
Parrot OS Ethical Hacking
Debian Stable Servers
Arch Linux Advanced Users

For this course we will use:

Ubuntu 24.04 LTS

because it is beginner friendly and widely supported.


Why Use WSL?

Without WSL:

Windows β†’ Install everything separately.

With WSL:

Windows + Linux together.

You get:

  • Linux Terminal
  • Ubuntu
  • Bash
  • Package Manager
  • SSH
  • Git
  • Node.js
  • Python
  • Docker support
  • C/C++

without leaving Windows.


Installing WSL


Step 1

Remove unnecessary software from Windows.

Open

Control Panel

or

Settings β†’ Apps

Uninstall software you no longer use.

This frees storage before installing development tools.


Step 2

Install Windows Terminal Preview

Open

Microsoft Store

Search

Windows Terminal Preview

Install it.

Why?

Because Windows Terminal provides

  • Multiple tabs
  • Better fonts
  • Better Linux support
  • Faster terminal

Step 3

Enable WSL Features

Open Start Menu

Search

PowerShell

Right Click

Run as Administrator

Run the following command.

Enable Windows Subsystem for Linux

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

What this does:

  • Enables Linux support inside Windows.

Now enable Virtual Machine Platform.

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

This installs the virtualization layer required for WSL2.


Restart your computer.


Step 4

Download WSL Update Package

Download:

https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

Install it normally.


Step 5

Enable Virtual Machine Platform

Open PowerShell (Admin)

Run

Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

Restart again if asked.


Step 6

Install Ubuntu

Open PowerShell

Run

wsl --install

What it does:

  • Downloads WSL
  • Downloads Ubuntu
  • Configures Linux automatically

Install Ubuntu 24.04

wsl --install -d Ubuntu-24.04

Set WSL2 as default.

wsl --set-default-version 2

Check installed distributions.

wsl --list --verbose

Example output

NAME            STATE      VERSION

Ubuntu-24.04    Running       2

Version should be 2.


Step 7

Open Ubuntu

Search

Ubuntu

Open it.

Wait around

2-3 minutes

The first launch installs Ubuntu.

Eventually it asks

Enter new UNIX username:

Example

suhail

Then

New Password:

Type your password.

Password will NOT be visible while typing.

Retype the password.

Done.


Important

Keep both the username and password the same.

Example

Username

suhail

Password

suhail

This makes it easier for beginners.


Step 8

Verify Ubuntu Setup

Every time Ubuntu opens, you should see something similar to

suhail@DESKTOP-XXXX:~$

Your username appears in green.

If Ubuntu never asked for username/password during setup, something likely went wrong and you should reinstall Ubuntu.


Step 9

Configure Windows Terminal

Open

Windows Terminal Preview

Click

β–Ό

then

Settings

Set

Default Profile

Ubuntu 24.04

Set

Default Terminal Application

Windows Terminal Preview

Click

Save

Now every new terminal opens directly into Ubuntu.


Your Linux Terminal is Ready πŸŽ‰

You can now install developer tools.


Installing Packages

Linux installs software using a package manager.

Ubuntu uses

APT

Understanding APT Commands

Update Package List

sudo apt update

What it does:

  • Connects to Ubuntu servers
  • Downloads the latest list of available software
  • Does not install anything
  • Simply refreshes the package database

Think of it like refreshing the App Store before downloading an app.

Example output

Hit:1 http://archive.ubuntu.com
Reading package lists...
Done

Upgrade Installed Software

sudo apt upgrade

What it does:

  • Checks for updates to software already installed on your computer
  • Downloads newer versions
  • Installs security patches
  • Updates libraries

Example

Node
Git
Python
Libraries

all get updated if newer versions exist.


Update + Upgrade Together

Instead of running both separately, developers usually run:

sudo apt update && sudo apt upgrade

Understanding &&

The && operator means:

Run the second command only if the first command succeeds.

So this:

sudo apt update && sudo apt upgrade

means:

  1. Refresh package list.
  2. If successful, update installed software.

This is one of the most common Linux commands.


What is sudo?

sudo

stands for

Super User DO

It temporarily gives administrator (root) permissions.

Some tasks require elevated permissions, such as:

  • Installing software
  • Updating packages
  • Changing system files

When you run a command with sudo, Ubuntu will ask for your password.

Example:

sudo apt update

Enter your password (it will not be shown as you type) and press Enter.


What is apt?

apt stands for Advanced Package Tool.

It is Ubuntu's package manager and is used to:

  • Install software
  • Update software
  • Remove software
  • Search for software

Examples:

sudo apt install git
sudo apt remove git
apt search nodejs

Installing Node.js Using NVM

NVM = Node Version Manager

It lets you install multiple versions of Node.js and switch between them easily.


Step 1

Install NVM

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

Understanding the command

  • curl downloads data from the internet.
  • -o- sends the downloaded script to the terminal.
  • | (pipe) passes that output to another command.
  • bash executes the downloaded installation script.

Step 2

Close the terminal.

Open it again.

This reloads your shell configuration so the nvm command becomes available.


Step 3

Install Node.js 22

nvm install 22

NVM downloads and installs Node.js version 22.


Step 4

Verify Node.js

node -v

Example output

v22.x.x

Step 5

Verify npm

npm -v

Example

10.x.x

If both commands display version numbers, Node.js and npm are installed successfully.


Mac Users

Install iTerm2.

Open Terminal.

Install NVM

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

Install Node

nvm install 22

Restart Terminal.

Check

node -v
npm -v

Installing VS Code

Download Visual Studio Code.

Install it.

Open VS Code.


Install Extensions

Install the following:

  • WSL (Ubuntu users)
  • Prettier
  • Auto Close Tag
  • JavaScript (ES6) Code Snippets
  • VSCode Icons
  • Live Server / Live Preview
  • Path IntelliSense
  • Prettify JSON

Choose a Theme

Open

Settings

Go to

Themes

Choose any color theme you like.


Installing C Compiler (Ubuntu)

Update packages

sudo apt update

Install GCC

sudo apt install build-essential

What is build-essential?

It is a package that installs the essential tools required to compile C and C++ programs, including:

  • GCC (GNU Compiler Collection)
  • G++
  • Make
  • Standard libraries

Check the compiler version

gcc --version

Note: The correct command is gcc --version (two hyphens), not gcc -version.


Create a C program

nano hello.c

Paste

#include<stdio.h>

int main()
{
    printf("Hello World");
    return 0;
}

Save the file and exit.

Compile the program

gcc hello.c

This creates an executable named a.out.

Run it

./a.out

Expected output

Hello World

Mac Users (C Compiler)

Install Apple's developer tools:

xcode-select --install

Verify the compiler:

clang --version

Connecting VS Code to the Terminal

Mac

Open VS Code.

Press:

Ctrl + Cmd + P

Type:

Shell Command:
Install 'code' command in PATH

Select it.

Open iTerm2 and run:

code .

This opens the current folder in VS Code.


Ubuntu (WSL)

Open VS Code.

Click the Remote Explorer icon on the left sidebar.

Select:

Ubuntu 24.04

Click the arrow to connect.

When connected successfully, you'll see Ubuntu 24.04 displayed in blue at the bottom-left of the VS Code window.


Frequently Used Linux Commands

Command Purpose
pwd Show current directory
ls List files and folders
ls -la Show all files (including hidden) with details
cd folder Enter a directory
cd .. Go back one directory
mkdir test Create a new folder
touch file.txt Create an empty file
rm file.txt Delete a file
rm -r folder Delete a folder recursively
clear Clear the terminal screen
history Show previously executed commands
whoami Display the current username
exit Close the terminal
code . Open the current folder in VS Code

Congratulations πŸŽ‰

You now have a complete Linux development environment with:

  • βœ… WSL2 installed
  • βœ… Ubuntu 24.04 configured
  • βœ… Windows Terminal set up
  • βœ… Node.js and npm installed using NVM
  • βœ… Visual Studio Code configured
  • βœ… GCC compiler installed
  • βœ… VS Code connected to WSL
  • βœ… Basic Linux commands learned

You're now ready to start building software using a professional Linux-based development workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment