Free lesson

Navigate filesystem with terminal

You will learn to navigate the filesystem using terminal commands. Practice moving between directories with cd, listing contents with ls, and identifying your current location with pwd. Understand the difference between absolute and relative paths, and create a workspace folder structure for your Python projects.

~25 min read · Free to read — no subscription required.

Understanding the Terminal

The terminal is a text-based way to tell your computer what to do. Instead of clicking on folders and files, you type commands. This might feel slower at first, but it becomes much faster with practice—and it's essential for working with AI systems.

Introduction

When you start working with AI APIs and Python projects, clicking through folders won't get you far—setting API keys, installing packages, and running scripts all happen through the terminal. Skip these basics and the moment a tutorial says "run this command," you're stuck: you can't follow along, can't verify the install worked, and can't even tell which folder the command is operating on. By the end of this lesson you'll be able to open a terminal on your operating system, read the prompt, see where you are with pwd, and list a folder's contents with ls.

Key Terminology

  • terminal — a text-based interface where you type commands instead of clicking; every later lesson in this track assumes you can open one and run a command in it
  • prompt — the line the terminal shows when it's ready for input (for example user@computer:~$); recognizing it tells you the shell is waiting on you and not stuck
  • working directory — the folder the terminal is currently "in"; commands like ls and pip install operate on this folder, so being in the wrong one runs the command in the wrong place
  • command — a word you type (such as pwd or ls) that the shell executes against the operating system; chaining the right commands is how every later setup step gets done

Concepts

The command loop

Every terminal interaction is the same short loop: the prompt waits, you type a command, the shell runs it, output prints, and the prompt returns. If you understand this loop, nothing the terminal does will surprise you.

Loading diagram...

Why the terminal matters for AI work

Working with AI APIs and Python is terminal-first by default. You'll set environment variables for API keys (you can't safely do this by clicking), install Python packages with pip, run scripts with specific parameters, and switch between project folders quickly. Every one of these tasks lives in the terminal, which is why pwd and ls are the first two commands worth knowing (see Code Walkthrough).

The working directory

Commands operate on the folder you're "in" right now — the working directory. pwd ("print working directory") prints that path; ls ("list") prints what's inside it. If you ever feel lost, those two commands tell you exactly where you are and what's around you.

Code Walkthrough

Now that the command loop, the working directory, and the terminal's role in AI work are clear, the walkthrough below ties them together: open the terminal, read the prompt, then run pwd and ls to confirm where you are and what's there.

Opening the terminal

  • macOS: press Cmd + Space, type Terminal, press Enter.
  • Windows: press Win + R, type cmd or powershell, press Enter.
  • Linux: press Ctrl + Alt + T.

You'll see a prompt that looks like user@computer:~$. The ~ is your home directory; the $ means the shell is ready for input. Now run the two foundational commands:

Code snippetbash
1# Where am I? 2pwd 3# Example output: 4# /Users/yourname 5 6# What's in this folder? 7ls 8# Example output: 9# Desktop Documents Downloads Pictures

pwd confirms the working directory; ls lists the files and folders inside it. These are the same folders you'd see in a file browser — you're just reading them through the terminal now.

You'll know it works when the prompt reappears after each command, the pwd output matches a real folder on your machine, and ls shows its contents without an error.

Do's and Don'ts

Having just walked through pwd and ls in the terminal, the habits below keep those commands working for you instead of against you.

Do's

  1. Do read the prompt before typing — confirm the shell is waiting ($ or >) so your command isn't lost or sent mid-execution.
  2. Do run pwd whenever you feel lost — it's the fastest way to confirm the working directory before running anything that touches files.

Don'ts

  1. Don't run install or setup commands without checking pwd — running them in the wrong folder installs packages or creates files in places you'll struggle to find later.
  2. Don't memorize commands by guessing — if you're not sure what a command does, look it up or run it in a throwaway folder first.

Keep going with GenAI Agent Engineering

Create a free account to track your progress and open this lesson in the full learning view. Subscribe to unlock the entire path — every goal, the hands-on labs, quizzes, and your verifiable skill graph — from . Cancel anytime.