Introduction
The command line is a text-based way to control your computer by typing instructions into a terminal, where a shell reads each command and carries it out immediately.
Part of the free Cli course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
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
💡 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.
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.
Now you try. Fill in the blank marked ___ using the hint in the comment, then run it.
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.
Your turn again. One command is missing — fill in the ___ so the program prints your current folder and then your username.
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. ehco instead of echo ) or a tool that isn't installed. Check the spelling first.
- Case sensitivity — the command line treats upper and lower case as different. PWD and Pwd won't work; the real command is the lowercase pwd . 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 called my notes.txt as "my notes.txt" .
Run these to see the exact messages the shell gives back:
📋 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
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.
🎉 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 echo text, find your folder with pwd , your username with whoami , and the time with date .
- ✅ 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 , and cd .
Practice quiz
What does the echo command do?
- Deletes a file
- Prints text back to the screen
- Changes directory
- Lists files
Answer: Prints text back to the screen. echo simply prints whatever text you give it to the screen.
Which command prints the folder you are currently in?
- pwd
- whoami
- date
- echo
Answer: pwd. pwd stands for Print Working Directory.
Which command prints your username?
- pwd
- date
- whoami
- ls
Answer: whoami. whoami prints the user account running the shell.
The command line is best described as a way to control your computer by what?
- Clicking icons
- Dragging windows
- Voice commands
- Typing text instructions
Answer: Typing text instructions. The CLI is a text-based way to control your computer by typing commands.
What is the program that reads and runs your commands called?
- The shell
- The mouse
- The browser
- The folder
Answer: The shell. The shell (such as bash) reads and runs your commands inside the terminal.
The dollar sign at the start of a command example is the prompt. Should you type it?
- Always type it
- No, you do not type it
- Only on Windows
- Only with echo
Answer: No, you do not type it. The $ is just the prompt; you never type it yourself.
Why should you wrap text with spaces in double quotes for echo?
- To make it faster
- To color the text
- To keep it as one piece of text
- To delete it
Answer: To keep it as one piece of text. Quotes keep spaced text together as a single argument.
What happens if you type EHCO instead of echo?
- It runs anyway
- It prints EHCO
- It clears the screen
- command not found
Answer: command not found. A typo gives bash: ehco: command not found.
The command line is case-sensitive, so typing PWD instead of pwd will do what?
- Fail with command not found
- Work the same
- Print the date
- Open an editor
Answer: Fail with command not found. PWD is not pwd; the CLI treats case as different, so it fails.
Which command shows the current system date and time?
- pwd
- date
- whoami
- echo
Answer: date. date prints the current date and time from the system clock.
Continue this course
- Next: File System Navigation