Lesson 1 • Beginner
Introduction to the Command Line
By the end of this lesson you'll know what the command line, shell, and terminal actually are, you'll be able to read a command prompt, and you'll have run your first four real commands — echo, pwd, whoami, and date.
What You'll Learn
- Explain what the command line is and why it's so powerful
- Tell the difference between a terminal, a shell, and the CLI
- Read a command prompt and know which part you actually type
- Print text to the screen with echo
- Find out where and who you are with pwd and whoami
- Show the system date and time with date
💡 Real-World Analogy
Think of the graphical interface (the windows, icons, and buttons you click) as ordering from a menu with pictures — quick and friendly, but you can only pick what's on the menu. The command line is like talking directly to the chef: you can ask for anything, customise every detail, and repeat the exact same order a thousand times without lifting a finger. It looks bare because it's powerful — there are no pictures in the way, just you telling the computer precisely what to do.
1. What Is the Command Line?
The command line is a text-based way to control your computer. Instead of clicking buttons and dragging files, you type an instruction, press Enter, and the computer carries it out immediately. Three words get used for closely related things, and it's worth pinning them down once:
| Term | What it is | Examples |
|---|---|---|
| Terminal | The window or app you type into | iTerm2, GNOME Terminal, Windows Terminal |
| Shell | The program that reads and runs your commands | bash, zsh, fish, PowerShell |
| CLI | The general idea of typing commands instead of clicking | git, npm, docker |
In casual conversation people mix these up constantly, and that's fine. The mental picture that matters: the shell (e.g. bash) runs inside the terminal window, and together they let you use the command line.
2. The Prompt — Where You Type
When you open a terminal, the shell shows a prompt — its way of saying "I'm ready, type something". It often ends in a dollar sign $ (or % on some Macs). The single most important rule for beginners: you don't type the prompt symbol. It's just the shell's marker for where your typing begins.
sam@laptop:~$ pwd | | | | └── the command YOU type | | | └──── the prompt symbol (do NOT type this) | | └────── the folder you're in (~ means your home folder) | └─────────── the computer's name └──────────────── your username
3. Why the Command Line Is So Powerful
If clicking is easier, why learn this? Because once a task can be typed, it can be repeated, combined, and automated — things a mouse can't do well.
- Speed — rename 1,000 files with one command instead of clicking each one.
- Automation — save commands in a script that runs the whole job while you sleep.
- Remote access — manage a server on the other side of the world over SSH, where there are no windows to click at all.
- Developer tools — Git, npm, Docker and most professional tools are command-line first.
- It's everywhere — the same skills work on almost every server, laptop, and cloud machine you'll ever touch.
4. Your First Command: echo
The friendliest place to start is echo, which simply prints text back to you. Wrap text in "double quotes" when it contains spaces or punctuation, so the shell treats it as one piece of text. Read this worked example, run it, and check your output matches.
# echo prints whatever text you give it straight back to the screen.
# It's the "Hello, World!" of the command line — safe and friendly.
echo Hello # one word -> no quotes needed
echo "Hello, command line!" # quotes keep the spaces as ONE piece of text
echo "I am learning the CLI" # punctuation is fine inside quotes tooHello
Hello, command line!
I am learning the CLIecho prints the same on every machine.Now you try. Fill in the blank marked ___ using the hint in the comment, then run it.
# 🎯 YOUR TURN — replace the ___ then run it in your terminal.
# 1) Print your own name to the screen.
echo ___ # 👉 put your name in "double quotes", e.g. "Alex"
# ✅ Expected output (example):
# AlexAlex___ with your name in double quotes, then run it and check the output.5. Where Am I & Who Am I? pwd, whoami, date
Three more safe, everyday commands answer questions about your current session. whoami prints your username, pwd (Print Working Directory) prints the folder you're currently "in", and date prints the system clock. None of them change anything — run them as often as you like.
# Three commands that ask the shell simple questions about your
# session: "who am I, where am I, and what time is it?".
# None of them change anything — they're completely safe to run.
whoami # which user account is running this shell?
pwd # Print Working Directory — the folder you are "in"
date # the current date and time, from the system clocksam
/home/sam
Sun Jun 15 14:32:07 UTC 2026Your turn again. One command is missing — fill in the ___ so the program prints your current folder and then your username.
# 🎯 YOUR TURN — one command is missing. Fill in the ___.
# 1) Ask the shell to print which folder you are currently in.
___ # 👉 the 3-letter "Print Working Directory" command
# 2) This one already works — it prints your username.
whoami
# ✅ Expected output (example):
# /home/alex
# alex/home/alex
alex___ with the right command, then run it. The exact folder and name will match your own machine.Pro Tip: the Tab key
Start typing a command or file name and press Tab — the shell finishes it for you (this is "tab completion"). Press Tab twice to see all the possibilities. It saves typing and prevents spelling mistakes, and it's one of the first habits that makes the terminal feel fast.
Common Errors (and the fix)
command not found— the shell didn't recognise what you typed. Almost always a typo (e.g.ehcoinstead ofecho) or a tool that isn't installed. Check the spelling first.- Case sensitivity — the command line treats upper and lower case as different.
PWDandPwdwon't work; the real command is the lowercasepwd. Type commands exactly as shown. - Spaces in text or names — a space normally separates one argument from the next. To keep text with spaces together, wrap it in "double quotes": use
echo "Hello there", and refer to a file calledmy notes.txtas"my notes.txt".
Run these to see the exact messages the shell gives back:
# Three mistakes every beginner makes — and what the shell says back.
# 1) A typo (or a tool that isn't installed):
ehco "hello" # 'echo' misspelled as 'ehco'
# 2) Wrong capitalisation — the CLI is CASE-SENSITIVE:
PWD # the real command is lowercase: pwd
# 3) A space in text without quotes splits it into separate arguments:
echo Hello there # the extra spacing is collapsed to one spacebash: ehco: command not found
bash: PWD: command not found
Hello there📋 Quick Reference
| Command | What it does | Example output |
|---|---|---|
| echo "text" | Print text to the screen | text |
| pwd | Print the current folder | /home/sam |
| whoami | Print your username | sam |
| date | Print the date and time | Sun Jun 15 … |
| clear | Clear the terminal screen | (blank screen) |
Frequently Asked Questions
Q: What is the difference between the terminal, the shell, and the command line?
The terminal is the window or app you type into (iTerm2, GNOME Terminal, Windows Terminal). The shell is the program running inside it that reads and runs your commands (bash, zsh, PowerShell). The command line (or CLI) is the general idea of controlling a computer by typing text instead of clicking. In everyday speech people use all three interchangeably, and that's usually fine.
Q: Do I need to install anything to follow this lesson?
On macOS and Linux a terminal and shell are already built in — just open the Terminal app. On Windows the friendliest options are Git Bash (installed with Git from git-scm.com) or WSL (Windows Subsystem for Linux), both of which give you the same bash commands shown here. You can also paste any command into a free online bash runner to try it instantly.
Q: What is the dollar sign ($) at the start of command examples?
The $ is the prompt — the shell's way of saying 'I'm ready for a command'. You do not type it. When a tutorial shows '$ pwd', you only type 'pwd' and press Enter. Some systems show a different prompt symbol such as % or >, but it means the same thing.
Q: Will typing commands break my computer?
The commands in this lesson — echo, pwd, whoami, and date — only read information or print text. None of them change or delete anything, so they are completely safe to run as often as you like. As you learn commands that do change files later, you'll always be told which ones to be careful with.
Mini-Challenge: Your CLI Report
No blanks this time — just a brief and an outline to keep you on track. Use only the four commands you learned, run it, and check your output against the example in the comments.
# 🎯 MINI-CHALLENGE: A "who am I, where am I" report
# Using ONLY the four commands from this lesson, write commands that:
# 1. echo a heading line: "--- My CLI report ---"
# 2. print your username
# 3. print the folder you are currently in
# 4. print the current date and time
#
# ✅ Expected output (example):
# --- My CLI report ---
# alex
# /home/alex
# Sun Jun 15 14:32:07 UTC 2026
# your commands here🎉 Lesson Complete!
- ✅ The command line is a text-based way to control your computer.
- ✅ A shell (bash) runs inside a terminal window; together they give you the CLI.
- ✅ The prompt (often
$) shows where you type — you never type the prompt symbol itself. - ✅ You can
echotext, find your folder withpwd, your username withwhoami, and the time withdate. - ✅ The CLI is case-sensitive, and you wrap text-with-spaces in
"double quotes". - ✅ Next lesson: File System Navigation — move around your folders with
pwd,ls, andcd.
Sign up for free to track which lessons you've completed and get learning reminders.