Meet the terminal
In movies, hackers type green text into a black window. That window is the terminal, and it's less scary than it looks. You type a command, press Enter, and the computer answers.
You will learn
- What the terminal and the shell are, and why people still use them
- How to read the prompt, and how it looks different on Rocky and Ubuntu
- The parts of a command: the command itself, its options and its arguments
- Keyboard tricks the pros use
Why type when you can click?
- Servers usually don't have a screen. Most Linux machines in the world sit in data centers with no monitor or mouse. The terminal is the only way to talk to them.
- It's faster. Something that takes ten clicks in a menu can be one line of text.
- You can repeat and automate it. You can save commands in a file and run them again, or run them on 1,000 machines at once.
- It works from far away. You can control a computer on the other side of the world over a slow connection (that's lesson 3).
The terminal is the window. The program inside it that reads your commands is called the shell. On both Rocky and Ubuntu, the shell is bash.
Reading the prompt
The text the computer shows before your cursor is called the prompt. It's the computer saying “I'm ready, what next?” It also tells you who and where you are. The two families draw it slightly differently:
Rocky shows only the name of the current folder, and the prompt has no colors.
Ubuntu shows the full path of the current folder, in green and blue.
~(the tilde) is short for your home folder.$means you're a normal user. If it ever turns into#, you're root, the all-powerful admin account, so be careful (more in lesson 12).
The parts of a command
Commands are like short sentences, and they have a grammar:
- The command is what to do. Here
lsmeans “list.” - Options (also called flags) change how the command works. They start with a dash:
-lmeans “long format.” You can combine them:-l -ais the same as-la. - Arguments say what the command works on, like a folder, a file or a website.
Five golden rules
- Upper and lower case are different.
lsworks,LSdoesn't.Documentsanddocumentsare two different names. - Spaces matter.
cd ..works,cd..doesn't. - No news is good news. Many commands print nothing when they work. If you get the prompt back with no error, it worked.
- Errors are clues, not punishments. Read them. They usually tell you exactly what's wrong.
- Commands are the same on both families. Everything in this lesson works the same on Rocky and Ubuntu. Only the prompt looks different.
Pro keyboard moves
| Key | What it does |
|---|---|
| ↑ / ↓ | Scroll through the commands you already typed. No need to retype them. |
| Tab | Auto-complete a command or file name. Type cd Doc and press Tab. Use it constantly. |
| Ctrl+C | Cancel or stop what's running. Your emergency exit. (It does not copy in a terminal!) |
Ctrl+L or clear | Clear the screen. |
Where do I get a real terminal?
- Windows 10/11: Open Windows Terminal or PowerShell. They include
ssh, which is all you need for the next lesson. (PuTTY and other apps are covered in lesson 4.) To run real Linux inside Windows, open PowerShell as administrator and typewsl --install. That installs Ubuntu. - Mac: Open the Terminal app. macOS isn't Linux, but it's a close cousin, and most commands here work.
- Chromebook: Go to Settings → Advanced → Developers → Linux development environment. That installs Debian.
- No computer of your own? Use the practice terminal on this site. That's what it's for.
Try it
Click in the terminal and complete the missions. You can type help at any time.
Quick check
1. The prompt ends in # instead of $. What does that mean?
✓ Right. # means root on every Linux distro.
2. In ls -a /tmp, which part is the option?
✓ Yes. Options start with a dash. ls is the command and /tmp is the argument.
3. You type a command, press Enter, and nothing is printed. Just a new prompt. What happened?
✓ Correct. Linux commands usually stay quiet when they succeed and only speak up when something goes wrong.