Foundations Module 4 · Command Line Basics

Opening Your Terminal

Last reviewed

Beginner

What you'll learn

~15 min
  • Open a terminal on macOS, Windows (PowerShell), or Linux
  • Run your first commands to verify the terminal works
  • Practise pwd, ls, mkdir, and cd on your own machine
  • 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, so follow along on your actual machine.

💡Opened a terminal in Lesson 1.2?

Then you already know where yours lives. Skim straight to The “Where Am I?” check, and use the same ai-class folder from Lesson 1.2 for the rest of this module.

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 Applications → Utilities
  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.

Paste with Cmd + V.

Practise the four survival commands. Type each line, press Enter, then type the next:

Terminal window
pwd
ls
mkdir ai-class
cd ai-class

pwd prints your location (for example /Users/name), ls lists what’s in your home folder, mkdir makes the ai-class folder without printing anything, and after cd ai-class your prompt shows ai-class instead of ~. If you made ai-class in Lesson 1.2, mkdir says it already exists; that’s fine, just run the cd line.

💡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: Windows Terminal and PowerShell

Your PC already has everything you need. No installs, no Administrator rights, no restart.

Open it

  1. Press Win + X (or right-click the Start button)
  2. Click Terminal. On Windows 10 the menu may say Windows PowerShell instead; click that.
  3. Skip any entry marked (Admin). You don’t need it for anything in this module.

Read the prompt. The text before the cursor tells you which shell you are in:

You seeYou’re inWhat to do
PS C:\Users\Name>PowerShellYou’re set. Use this.
C:\Users\Name> (no PS)Command Prompt (CMD)Type powershell and press Enter to switch
name@PC:~$WSL (Ubuntu, Linux inside Windows)Also fine; every command below works there too

Paste with Ctrl + V or a right-click inside the window.

Practise the four survival commands. Type each line, press Enter, then type the next:

Terminal window
pwd
ls
mkdir ai-class
cd ai-class

What you’ll see:

  • pwd prints a small table headed Path, with your location underneath (for example C:\Users\Name).
  • ls lists what’s in your home folder, with columns for date, size and name.
  • mkdir ai-class prints a short line describing the new folder. That means it worked. If you made ai-class in Lesson 1.2, it says the folder already exists instead; that’s fine.
  • cd ai-class prints nothing; your prompt changes to PS C:\Users\Name\ai-class>.

Run pwd once more to confirm where you are.

💡One command per line

Some guides join two commands with && on one line. Windows PowerShell 5.1, the version built into Windows, rejects that, so this course always puts each command on its own line. Two lines work in every shell.

All four AI CLI tools this course uses install and run natively on Windows, and Module 6 walks through each one. You can do this whole course from PowerShell.

Curious about Linux on your PC? WSL2 runs Ubuntu inside Windows, and it’s the route to Linux containers and the faster development setup. You don’t need it to continue. Lesson 4.5 explains why you might want it and walks through setting it up.

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.

Paste with Ctrl + Shift + V (plain Ctrl + V usually doesn’t paste in a Linux terminal).

Practise the four survival commands. Type each line, press Enter, then type the next:

Terminal window
pwd
ls
mkdir ai-class
cd ai-class

pwd prints your location (for example /home/user), ls lists what’s in your home folder, mkdir makes the ai-class folder without printing anything (or says it already exists, if you made it in Lesson 1.2), and after cd ai-class your prompt ends in ~/ai-class$. Run pwd once more to confirm.

Your first command

Let’s verify your terminal is working. Type this and press Enter (it works the same in PowerShell, macOS and Linux):

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.”

How to check it worked: the line Hello, World! appears on its own line under your command, and a fresh prompt returns below it.

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?

All three work in PowerShell too. On Windows, whoami answers in the form computername\name.

This becomes critical later when you’re working across multiple environments (your laptop, a remote server, WSL). Think of these three as your phone’s status bar: run them whenever you open a new terminal window or connect to a new machine. Always know where you are before running commands.

🏛️In Your Field: Government 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.
  • Type commands in lowercase. In bash and zsh (Mac, Linux, WSL), echo works but Echo does not. PowerShell is more forgiving about case, but lowercase works everywhere, and spelling always matters.
💡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

Before the next lesson, make sure your terminal is in the practice folder. Run pwd one more time: the path should end in ai-class, such as C:\Users\Name\ai-class, /Users/name/ai-class, or /home/name/ai-class. If it doesn’t, type cd ~ and then cd ai-class. If a command says it can’t find something, check the spelling and run pwd to see where you are. Keep this terminal open for the next lesson.

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 4.5, we’ll cover how to connect to those remote environments using SSH. For now, any terminal you can open will do, including PowerShell on a locked-down Windows machine: everything in this module works there.

🔧

When Things Go Wrong

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

Symptom
My Windows prompt has no PS at the start
Evidence
C:\Users\Name>
What to ask the AI
"You're in Command Prompt (CMD), not PowerShell. Type powershell and press Enter; the prompt changes to start with PS. Next time, open Terminal from Win + X and it starts in PowerShell."
Symptom
mkdir says the folder already exists
Evidence
An item with the specified name C:\Users\Name\ai-class already exists.
What to ask the AI
"You made it in Lesson 1.2, so there's nothing to fix. Skip the mkdir and just run cd ai-class."
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, press Win + X and open Terminal. PowerShell (PS C:\Users\Name>) works for everything in this module, with no install or Admin rights. WSL is optional, and Lesson 4.5 covers it.
  • On Linux, press Ctrl+Alt+T or search for Terminal in your app menu.
  • pwd, ls, mkdir and cd work the same in PowerShell, macOS and Linux. Type each on its own line.
  • 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.
🔍PowerShell or WSL?click to expand

Start with whatever you have. PowerShell understands pwd, ls, mkdir, cd, cat, cp, mv, rm and clear out of the box, accepts cd ~, and takes forward slashes in paths (cd projects/my-app), so the commands in this module read the same on every system. All four AI CLI tools in this course install natively on Windows.

WSL2 runs a real Linux system alongside Windows. It earns its place once you are developing seriously, and Lesson 4.5 explains when and how to make that move.

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.

Search lessons