Getting Started · #5 of 19
The Terminal
Your Command Center
Why the Terminal?
The graphical interface is nice, but the terminal is:
- Faster: Type commands instead of clicking through menus
- Scriptable: Automate repetitive tasks
- Consistent: Works the same across all Linux systems
- Powerful: Access features GUIs don’t expose
- Remote: Works over SSH on servers
Anatomy of a Command
┌──────────────────────────────────────────┐
│ user@ubuntu:~$ ls -la /home │
│ └──┬───────┘ └┘ └─┬─┘ └──┬──┘ │
│ │ │ │ │ │
│ prompt command flags argument │
└──────────────────────────────────────────┘
- Prompt: Shows user, hostname, current directory
- Command: The program to run
- Flags/Options: Modify behavior (usually start with -)
- Arguments: What the command operates on
Essential Commands
Navigation & Information
pwd # Print working directory (where am I?)
ls # List files and directories
ls -l # Long format (permissions, size, date)
ls -la # Include hidden files (starting with .)
cd /path/to/dir # Change directory
cd ~ # Go to home directory
cd .. # Go up one level
cd - # Go to previous directory
Getting Help
man ls # Manual page for 'ls'
ls --help # Quick help for 'ls'
whatis ls # One-line description
Terminal Control
clear # Clear the screen (or Ctrl + L)
history # Show command history
exit # Close terminal
Keyboard Shortcuts
| Shortcut | Action |
|----------|--------|
| Tab | Autocomplete command/path |
| Tab Tab | Show all possible completions |
| ↑ / ↓ | Navigate command history |
| Ctrl + C | Cancel current command |
| Ctrl + L | Clear screen |
| Ctrl + R | Search command history |
| Ctrl + A | Move cursor to start of line |
| Ctrl + E | Move cursor to end of line |
| Ctrl + U | Delete from cursor to start |
| Ctrl + K | Delete from cursor to end |
The Manual (man pages)
Every command has a manual. Press q to exit.
man ls # How to use 'ls'
man man # Manual for the manual!
Sections of a man page:
- NAME: What the command is called
- SYNOPSIS: How to use it
- DESCRIPTION: What it does in detail
- OPTIONS: Available flags
- EXAMPLES: Usage examples (not always present)
Try It!
Use the terminal below to practice basic commands:
Suggested commands:
pwd— see where you arels— list filesls -la— show hidden files with detailscd /etc— change to /etc directorycat /etc/hostname— display your hostnamehistory— see what you’ve typedhelp— see available commands
Try it in the terminal
A sandboxed shell with this lesson’s commands. Type help to see what’s available.