Linux · Lesson 8 of 14
Linux terminal basics
Learn the Linux terminal from zero: the shell, files and paths, and your first commands (pwd, ls, cd, cat). Practise in a safe in-browser terminal.
⏱ 18 min🎯 Beginner🧪 Hands-on practice🎬 Video
By the end, you’ll be able to…
- Explain what the terminal and the shell are
- Move around the file system with pwd, ls and cd
- Read files and get help with cat, less and man
Key words
- Terminal
- The window where you type commands.
- Shell
- The program that reads your commands and runs them. Bash and Zsh are common shells.
- Directory
- Another word for folder.
- Path
- The address of a file or folder, like /home/student/notes.txt.
- Home directory
- Your personal folder, written as ~ for short.
- Root (/)
- The very top of the Linux file system. Everything lives under it.
Why learn the terminal?
Most servers on the internet run Linux, and most of them have no screen or mouse. Security tools, logs and cloud machines are all driven by text commands. The terminal is also fast: one line can do what would take fifty clicks.
The good news: you only need about ten commands to feel at home.
The prompt
student@tuxlab:~$
That means: user student, on a computer called tuxlab, currently in ~ (your home folder). The $ means you’re a normal user. A # would mean you’re root, the all-powerful admin account, so be careful there.
The file system is an upside-down tree
Linux has one top folder called root, written /. Everything hangs below it:
/
├── home/
│ └── student/ ← your home (~)
│ ├── Documents/
│ └── notes.txt
├── etc/ ← system settings
├── var/
│ └── log/ ← log files
└── tmp/ ← temporary files
Your first commands
| Command | Means | Example |
|---|---|---|
pwd | print working directory: where am I? | pwd |
ls | list what’s here | ls -la (long format, include hidden) |
cd | change directory | cd Documents, cd .., cd ~ |
cat | print a file | cat notes.txt |
less | scroll through a long file (q to quit) | less /var/log/syslog |
man | the manual for a command | man ls |
mkdir / touch | make a folder / an empty file | mkdir lab |
clear | clean the screen | clear |
Absolute vs relative paths
- Absolute paths start at
/and work from anywhere:/home/student/Documents. - Relative paths start from where you are: if you’re in
/home/student, thenDocumentsmeans the same folder. .means “this folder” and..means “one folder up”.~means “my home folder”.
Hidden files
Files whose names start with a dot, like .bashrc, are hidden from plain ls. Use ls -a to see them. Lots of settings live in hidden files.
Three habits that save hours
- Tab completion: type the first few letters of a name and press Tab.
- History: press ↑ to bring back earlier commands.
- Read before you run: never paste commands from the internet that you don’t understand, especially ones starting with
sudoor containingrm -rf.
Use the practice terminal below right now. Later, try a free virtual machine (see Build a safe lab), WSL on Windows, or the beginner wargame OverTheWire Bandit.
🧪 Hands-on
Practice
This is a pretend Linux machine that runs entirely in your browser, so you can’t break anything. Work through the missions. Type help any time.
🎬 Watch
Video: Linux for Hackers (and everyone) – EP 1
Video by NetworkChuck, hosted on YouTube. It loads only when you press play.
✅ Check yourself
Quick quiz
🔗 Go further
Trustworthy resources
- OverTheWire: Bandit Free beginner Linux wargame. Perfect next step.
- Linux Journey Friendly, bite-sized Linux lessons.
- tldr pages Short, practical examples for common commands.
- Linux man pages The official manuals, online.