Foundations Module 3 · Command Line Basics

Opening Your Terminal

What you'll learn

~15 min
  • Open a terminal on macOS, Windows (WSL), or Linux
  • Run your first commands to verify the terminal works
  • Set up WSL on Windows for a consistent Linux experience
  • Develop the 'Where Am I?' habit for orienting yourself

By the end of this lesson, you will have a working terminal open on your computer and will have successfully run your first commands. This is a hands-on lesson — follow along on your actual machine.

The mental model: finding the front door

Every building has a front door, even if you’ve never noticed it. Your computer has a terminal built in — it’s just not on the home screen because most people never need it. Today, we find the front door and walk through it.

Let’s find your terminal

Pick your operating system below and follow the steps.

macOS

You have two easy options:

Option 1 — Spotlight Search (fastest)

  1. Press Cmd + Space to open Spotlight
  2. Type Terminal
  3. Press Enter

Option 2 — Finder

  1. Open Finder
  2. Go to ApplicationsUtilities
  3. Double-click Terminal

You’ll see a window with a prompt that looks like:

Terminal window
username@MacBook ~ %

The % at the end is your prompt symbol (macOS uses % instead of $ by default — they mean the same thing).

Pro tip: Right-click Terminal in the Dock and select “Keep in Dock” so you can open it with one click next time.

💡macOS already has a Unix shell

Good news — macOS is built on Unix, which means the terminal commands in this course work natively. No extra setup needed. Your Mac ships with zsh as the default shell. For this course’s basic commands, zsh and bash behave the same. Advanced scripting differences are outside the scope of this course.

Windows — Use WSL (Windows Subsystem for Linux)

Here’s the deal: most AI CLI tool documentation and tutorials are written for Linux/bash first. Windows has PowerShell, but it uses different syntax for environment variables, file paths, and scripting — which means you’d spend time translating commands instead of learning. WSL reduces that friction.

Linux Linux A free operating system that powers most servers and developer tools. Learn more → is a free operating system that powers most servers, developer tools, and AI infrastructure. You don’t need to replace Windows — WSL WSL Windows Subsystem for Linux — runs a Linux environment inside Windows. Learn more → lets Windows run a Linux environment in a contained workspace so that course commands work exactly as written.

The fix is simple: WSL (Windows Subsystem for Linux) gives you a real Linux terminal right inside Windows. It’s built into Windows 10/11 and takes 5 minutes to set up.

Step 1: Install WSL

Open PowerShell as Administrator (right-click Start → Terminal (Admin) or search “PowerShell” and click “Run as administrator”):

Terminal window
wsl --install

This installs Ubuntu by default. Restart your computer when prompted.

If WSL install fails

wsl --install requires Windows 10 version 2004 or later, and Hardware Virtualization must be enabled in your computer’s BIOS/UEFI. If the install fails with a virtualization error, you may need to enable it in your BIOS settings. If you can’t resolve it, see the Remote Environments lesson for alternatives like GitHub Codespaces.

Step 2: Set up your Linux user

After restart, WSL opens automatically and asks you to create a username and password. Pick something simple — this is just for your local Linux environment.

Step 3: Open your Linux terminal

From now on, you have three ways to open your Linux terminal:

  1. Search for “Ubuntu” in the Start menu
  2. Open Windows Terminal and click the dropdown arrow → select Ubuntu
  3. Type wsl in any PowerShell/CMD window

You’ll see a prompt like:

Terminal window
username@DESKTOP-ABC123:~$

That’s a real Linux shell. Every command in this course will work exactly as written.

💡Install Windows Terminal

If you don’t have Windows Terminal yet, get it from the Microsoft Store. It lets you run PowerShell, CMD, and WSL tabs side by side. Always use the Ubuntu/WSL tab for this course.

Stay inside the Linux filesystem

When working in WSL, keep your files in your Linux home directory (~ or /home/yourname). Don’t work from /mnt/c/Users/... — that’s your Windows drive mounted inside Linux, and it can be slower and may cause permission or file-watcher issues for some tools. Your Linux home is where you want to be.

Already have WSL? Just open your Ubuntu terminal and you’re good to go.

Can’t install WSL? (university lab machines, work computers without admin rights) — no worries. We cover alternatives in the Remote Environments lesson — including VS Code, SSH, and GitHub Codespaces.

Linux

You likely already know this one! But just in case:

Option 1 — Keyboard shortcut

  • Most Linux desktops: Ctrl + Alt + T

Option 2 — Application menu

  1. Open your application menu/launcher
  2. Search for Terminal, Console, or Konsole (KDE)
  3. Click to open

You’ll see a familiar prompt:

Terminal window
user@hostname:~$

Different desktop environments ship different terminal emulators (GNOME Terminal, Konsole, xfce4-terminal, etc.) — they all work the same way for our purposes.

Your first command

Let’s verify your terminal is working. Type this and press Enter:

Terminal window
echo "Hello, World!"

You should see:

Hello, World!

That’s it! You just ran your first terminal command. echo simply repeats back whatever you give it — it’s the terminal equivalent of “say this out loud.”

Try it in the practice terminal below:

Claude Code — Practice Mode
Type a command and press Enter. Try: pwd, ls, cd projects, help
/home/user $
TRY ITUse the echo command to print 'Hello, World!'
$

The “Where Am I?” check

Get in the habit of running these three commands whenever you open a terminal. They tell you exactly where you are:

Terminal window
whoami # What user am I?
hostname # What machine am I on?
pwd # What directory am I in?

This becomes critical later when you’re working across multiple environments (your laptop, a remote server, WSL). Always know where you are before running commands.

💡Make this a reflex

Think of whoami, hostname, and pwd as looking at your phone’s status bar — it tells you your connection, battery, and time at a glance. These three commands give you the same situational awareness in the terminal. Run them whenever you open a new terminal window or connect to a new machine.

🏛️In Your Field: Government / State Devclick to expand

In government environments, you often switch between your local machine, a jump host, and a production server. Running whoami and hostname before each command is not just good practice — it’s a safety habit. You do not want to accidentally run a destructive command on the wrong server. Many agencies require this kind of awareness as part of their operational security protocols.

Don’t panic about the blank screen

When you first open a terminal, it might feel like staring at a blank text document with a blinking cursor. Nothing’s broken — it’s just waiting for you.

Key things to remember:

  • It won’t do anything until you press Enter. You can type, delete, retype — nothing happens until you hit Enter.
  • You can always press Ctrl+C to cancel. If something seems stuck or you made a mistake, Ctrl+C is your “stop everything” button.
  • Commands are case-sensitive. In bash (Mac/Linux/WSL), echo works but Echo does not. Spelling and case both matter — the terminal is very literal.
💡Your terminal remembers

Press the Up arrow key to bring back your previous command. This is incredibly useful — you’ll use it constantly. Press Up multiple times to scroll through your command history.

A note on appearance

Your terminal might look different from screenshots in this course — different colors, fonts, or prompt styles. That’s completely normal. The commands work exactly the same regardless of how the terminal looks. Don’t spend time customizing it now — focus on learning the commands first.

Quick confidence check

Let’s make sure everything works. Try each of these in order:

TRY ITPrint your current working directory (where you are in the filesystem)
$
TRY ITList the files and folders in your current directory
$
KNOWLEDGE CHECK

You open a terminal and see: sarah@lab-pc-42:~$ — What does this tell you?

🧬In Your Field: Biotechclick to expand

If you’re on a university lab machine that doesn’t let you install software, don’t worry. Your institution likely provides access to a Linux server or HPC cluster. In Lesson 5, we’ll cover how to connect to those remote environments using SSH. For now, if you can open any terminal at all — even PowerShell on a locked-down Windows machine — you’re in good shape for learning the basics.

🔧

When Things Go Wrong

Use the Symptom → Evidence → Request pattern: describe what you see, paste the error, then ask for a fix.

Symptom
WSL install says 'This command requires administrator privileges'
Evidence
Error: This operation requires elevation. Run PowerShell as Administrator.
What to ask the AI
"I'm trying to install WSL but I get an administrator error. How do I open PowerShell as Administrator on Windows?"
Symptom
After installing WSL, I don't see Ubuntu in the Start menu
Evidence
I ran 'wsl --install' and restarted, but I can't find Ubuntu anywhere
What to ask the AI
"I installed WSL but Ubuntu isn't showing up. How do I check if WSL installed correctly and open Ubuntu?"
Symptom
My terminal shows a different prompt symbol (% instead of $)
Evidence
My Mac terminal shows username@MacBook ~ % instead of $
What to ask the AI
"That's perfectly normal! macOS uses % as the default prompt symbol, while Linux uses $. They work the same way — type your command after the symbol and press Enter."
Symptom
The terminal says 'command not found' for everything I type
Evidence
bash: hello: command not found
What to ask the AI
"You're probably typing regular words instead of commands. Try typing exactly: echo hello — the word 'echo' is the command, and 'hello' is what it prints."

Key takeaways

  • Most personal computers include a terminal built in — you just need to know where to find it (though some managed systems may restrict access).
  • On Mac, use Spotlight (Cmd+Space) to search for “Terminal.”
  • On Windows, install WSL for a real Linux shell — it’s the standard for this course.
  • On Linux, press Ctrl+Alt+T or search for Terminal in your app menu.
  • Always run whoami, hostname, and pwd when you open a new terminal — know where you are before running commands.
  • Ctrl+C cancels anything. Up arrow recalls your last command. These two shortcuts will save you constantly.
🔍Why WSL instead of PowerShell?

You might wonder why we don’t just teach PowerShell on Windows. Three practical reasons:

  1. Consistency. Every AI CLI tool’s documentation, every Stack Overflow answer, and every tutorial assumes bash/Linux. With WSL, you can follow any guide verbatim.
  2. Environment variables. Setting API keys (which you’ll do constantly with LLM tools) uses different syntax: export KEY=value in bash vs. $env:KEY = "value" in PowerShell. Every tool’s setup guide shows the bash version.
  3. File paths. Linux uses forward slashes (/home/user), PowerShell uses backslashes (C:\Users\user). AI tools and their configs expect forward slashes.

WSL gives you a real Linux environment that runs alongside Windows. WSL2 uses lightweight virtualization integrated into Windows, so it feels near-native. Files, clipboard, and networking all work seamlessly between Windows and WSL.

What’s next

Now that your terminal is open, let’s learn to move around. The next lesson covers navigation — how to see where you are and go where you want.