This page is a friendly cheatsheet to help you feel comfortable using:
- CMD (Command Prompt)
- PowerShell
- Linux terminal inside WSL (Ubuntu)
It focuses on the exact skills you need to follow your server guide: navigating folders, running commands, editing files, and understanding what’s going on.
1. Opening CMD, PowerShell, and Ubuntu
1.1 Open Command Prompt (CMD)
- Press Windows key.
- Type
cmd. - Press Enter.
1.2 Open PowerShell
- Press Windows key.
- Type
PowerShell. - Click Windows PowerShell.
- To run as admin: right‑click → Run as administrator.
1.3 Open Ubuntu (WSL)
- Press Windows key.
- Type
Ubuntu. - Click the Ubuntu app (e.g. Ubuntu 22.04 LTS).
2. Basic Navigation Concepts
All three environments (CMD, PowerShell, Linux) use the idea of a “current folder” (also called a directory). Commands usually act on the current folder.
2.1 See Where You Are
- CMD:
cd - PowerShell:
pwd - Linux (Ubuntu):
pwd
2.2 Change Folder
- CMD:
cd C:\Users\YourName - PowerShell:
cd C:\Users\YourName - Linux:
cd /home/youruser
2.3 List Files in Current Folder
- CMD:
dir - PowerShell:
lsorGet-ChildItem - Linux:
lsorls -l
~ means “your home folder” (e.g. /home/youruser).
So cd ~ always takes you back home.
3. Running Commands Safely
3.1 What “sudo” Means (Linux)
In Ubuntu, many system commands start with sudo. It means “run this as an administrator”. Example:
sudo apt update
When you see sudo, Ubuntu may ask for your password. Type it and press Enter (you won’t see the characters as you type — that’s normal).
3.2 Admin vs Non‑Admin in Windows
Some commands (like netsh or editing system settings) require PowerShell “as administrator”. If a command fails with “access denied”, try reopening PowerShell with:
- Right‑click → Run as administrator
sudo or in admin PowerShell. They can change system settings.
4. Creating and Editing Files
4.1 In Windows (Notepad)
- Open File Explorer (Windows + E).
- Navigate to the folder (e.g.
C:\). - Right‑click → New → Text Document.
- Rename it (e.g.
wsl-portproxy.ps1). - Right‑click the file → Edit (opens in Notepad).
- Paste the content → File → Save.
4.2 In Linux (nano editor)
nano is a simple text editor inside the terminal.
4.2.1 Create or Edit a File
- In Ubuntu, go to the folder:
cd ~/server/web/public - Open a file with nano:
nano index.php - If the file exists, you’ll see its contents. If not, nano will create it when you save.
4.2.2 Basic nano Controls
- Ctrl + O → Write Out (Save)
- Enter → Confirm filename
- Ctrl + X → Exit nano
- Ctrl + K → Cut line
- Ctrl + U → Paste line
5. Copy & Paste in Terminals
5.1 Windows (CMD / PowerShell)
- Copy from terminal: Select text with mouse → right‑click → it copies.
- Paste into terminal: Right‑click where you want to paste.
5.2 Ubuntu (WSL) Terminal
- Copy: Select text with mouse → right‑click → Copy.
- Paste: Right‑click → Paste.
6. Understanding Paths
6.1 Windows Paths
Examples:
C:\Users\YourName\DocumentsC:\wsl-portproxy.ps1
6.2 Linux Paths
Examples:
/home/youruser→ your home folder/home/youruser/server/web/public→ your web root
Special shortcuts in Linux:
~→ your home folder.→ current folder..→ parent folder
7. Useful Everyday Commands
7.1 Linux (Ubuntu)
pwd→ show current folderls→ list filesls -l→ detailed listcd foldername→ go into foldercd ..→ go up one levelmkdir name→ create folderrm file→ delete filesudo systemctl restart nginx→ restart Nginxsudo systemctl status nginx→ check Nginx status
7.2 PowerShell
pwd→ show current folderls→ list filescd C:\path\to\folder→ change foldernetsh interface portproxy show all→ show portproxy rules
8. When Something Fails
8.1 Read the Error Message Slowly
Most errors tell you exactly what’s wrong:
- “Permission denied” → you might need
sudoor admin PowerShell. - “Command not found” → maybe you mistyped or the program isn’t installed.
- “No such file or directory” → check the path and spelling.
8.2 Check Services
- Nginx:
sudo systemctl status nginx - MySQL:
sudo systemctl status mysql
8.3 Restart WSL
In PowerShell (admin):
wsl --shutdown
Then reopen Ubuntu from the Start menu.
9. Mental Model: What’s Running Where?
- Windows is the host machine.
- Ubuntu (WSL) is a Linux environment inside Windows.
- Nginx, PHP, MySQL, Node all run inside Ubuntu.
- PowerShell controls Windows settings (like portproxy).
If you remember that, it’s easier to know whether to type a command in Ubuntu or PowerShell.
10. Quick “Which Terminal Do I Use?” Cheat
- Install Linux packages (apt, nginx, mysql, node): Ubuntu
- Edit web files (PHP, Node code): Ubuntu (nano)
- Set up port forwarding (netsh): PowerShell (admin)
- Check Windows firewall: Windows GUI (Firewall app)
Keep this page open while you work through your main server guide. If a step says “run this in Ubuntu”, come back here if you forget how to navigate or edit files.