Command Line Tips & Tricks Guide

Windows CMD · PowerShell · Linux Terminal (WSL) — Practical Cheatsheet for Your Server Setup

This page is a friendly cheatsheet to help you feel comfortable using:

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)

  1. Press Windows key.
  2. Type cmd.
  3. Press Enter.

1.2 Open PowerShell

  1. Press Windows key.
  2. Type PowerShell.
  3. Click Windows PowerShell.
  4. To run as admin: right‑click → Run as administrator.

1.3 Open Ubuntu (WSL)

  1. Press Windows key.
  2. Type Ubuntu.
  3. Click the Ubuntu app (e.g. Ubuntu 22.04 LTS).
Tip: You can keep Ubuntu, CMD, and PowerShell open at the same time in different windows.

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

2.2 Change Folder

2.3 List Files in Current Folder

Tip: In Linux, ~ 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:

Warning: Only run commands you understand, especially with sudo or in admin PowerShell. They can change system settings.

4. Creating and Editing Files

4.1 In Windows (Notepad)

  1. Open File Explorer (Windows + E).
  2. Navigate to the folder (e.g. C:\).
  3. Right‑click → New → Text Document.
  4. Rename it (e.g. wsl-portproxy.ps1).
  5. Right‑click the file → Edit (opens in Notepad).
  6. 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

  1. In Ubuntu, go to the folder:
    cd ~/server/web/public
  2. Open a file with nano:
    nano index.php
  3. If the file exists, you’ll see its contents. If not, nano will create it when you save.

4.2.2 Basic nano Controls

Tip: If you get stuck in nano, press Ctrl + X. If it asks to save, press N for no or Y for yes.

5. Copy & Paste in Terminals

5.1 Windows (CMD / PowerShell)

5.2 Ubuntu (WSL) Terminal

Tip: You can also use Ctrl + Shift + C / V in some terminals.

6. Understanding Paths

6.1 Windows Paths

Examples:

6.2 Linux Paths

Examples:

Special shortcuts in Linux:

7. Useful Everyday Commands

7.1 Linux (Ubuntu)

7.2 PowerShell

8. When Something Fails

8.1 Read the Error Message Slowly

Most errors tell you exactly what’s wrong:

8.2 Check Services

8.3 Restart WSL

In PowerShell (admin):

wsl --shutdown

Then reopen Ubuntu from the Start menu.

9. Mental Model: What’s Running Where?

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

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.