The interface and the Terminal
Table of contents
- Graphical interface vs command line
- Why the terminal is essential
- Opening and using the terminal
- Anatomy of the prompt
- First steps in the terminal
1 - Graphical interface vs command line
Two ways to interact with Linux
Comparison
| Aspect | Graphical Interface (GUI) | Command Line (CLI) |
|---|---|---|
| Learning | Intuitive | Requires training |
| Speed | Slow (mouse) | Fast (keyboard) |
| Automation | Difficult | Easy (scripts) |
| Resources | Heavy | Lightweight |
| Remote access | Complex | Simple (SSH) |
| Precision | Limited | Total |
| Servers | Rarely available | Always available |
Concrete example
Create 100 folders named projet_1 to projet_100:
In GUI: Right-click → New folder → Name → Repeat 100 times... ⏱️ ~30 minutes
In CLI:
mkdir projet_{1..100}
⏱️ 1 second!
The command line may seem intimidating at first, but it quickly becomes indispensable. It's an investment that pays off enormously!
🔝 Back to table of contents
2 - Why the terminal is essential
Practical reasons
In the professional world
| Context | Why the terminal? |
|---|---|
| Servers | No graphical interface |
| Cloud | SSH access only |
| Docker | Command-line commands |
| CI/CD | Automated pipelines |
| Kubernetes | kubectl on the command line |
| Ansible | Automated configuration |
What the terminal allows
- Automate repetitive tasks
- Administer remote servers
- Diagnose problems quickly
- Process large amounts of data
- Integrate into DevOps pipelines
In the DevOps world, 95% of your work is done on the command line. Mastering the terminal is not optional!
🔝 Back to table of contents
3 - Opening and using the terminal
On Ubuntu Desktop
Method 1: Keyboard shortcut (recommended)
Ctrl + Alt + T
Method 2: Menu
- Click "Activities" (top-left corner)
- Type "Terminal"
- Click the Terminal icon
Method 3: Right-click
- Right-click on the desktop
- "Open a terminal"
On WSL2 (Windows)
Method 1: Start menu
- Search for "Ubuntu"
- Click the Ubuntu application
Method 2: Windows Terminal (recommended)
- Install Windows Terminal from the Microsoft Store
- Open Windows Terminal
- Select Ubuntu from the tabs
Method 3: Command
# Dans PowerShell ou cmd
wsl
The terminal interface
┌─────────────────────────────────────────────────────────┐
│ Terminal - □ x │
├─────────────────────────────────────────────────────────┤
│ │
│ user@ubuntu:~$ │
│ │
│ │
│ │
│ │
│ │
└─────────────────────────────────────────────────────────┘
🔝 Back to table of contents
4 - Anatomy of the prompt
The prompt is the command line that awaits your instructions.
Structure of the prompt
user@hostname:~$
│ │ │ │
│ │ │ └── $ = utilisateur normal (# = root)
│ │ └──── ~ = répertoire courant (home)
│ └───────────── hostname = nom de la machine
└────────────────── user = nom d'utilisateur
Prompt examples
| Prompt | Meaning |
|---|---|
john@ubuntu:~$ | John, on ubuntu, in his home |
john@ubuntu:/etc$ | John, on ubuntu, in /etc |
root@server:/# | Root (admin), in / (root) |
deploy@prod:/var/log$ | The deploy user, in /var/log |
Important symbols
| Symbol | Meaning |
|---|---|
$ | Normal user |
# | Root user (administrator) |
~ | The user's home directory |
/ | Root of the file system |
. | Current directory |
.. | Parent directory |
When you see # instead of $, you are in root mode (administrator). Be very careful, you can break everything!
The cursor
The blinking cursor indicates where your text will be typed:
user@ubuntu:~$ █
└── Curseur clignotant
🔝 Back to table of contents
5 - First steps in the terminal
Your first command
Type this command and press Enter:
echo "Bonjour, Linux !"
Result:
Bonjour, Linux !
echo displays the text you give it.
Basic commands to try
# Afficher la date et l'heure
date
# Afficher le calendrier du mois
cal
# Afficher qui vous êtes
whoami
# Afficher le nom de la machine
hostname
# Afficher le répertoire courant
pwd
# Effacer l'écran
clear
Essential keyboard shortcuts
| Shortcut | Action |
|---|---|
Tab | Auto-completion |
↑ / ↓ | Command history |
Ctrl + C | Cancel the current command |
Ctrl + L | Clear the screen (like clear) |
Ctrl + A | Go to the beginning of the line |
Ctrl + E | Go to the end of the line |
Ctrl + U | Delete the line before the cursor |
Ctrl + R | Search in the history |
Auto-completion with Tab
The Tab key is your best friend:
# Tapez "wh" puis Tab
wh[Tab]
# Affiche les commandes commençant par "wh" :
# whatis whereis which while who whoami
# Tapez "whoa" puis Tab
whoa[Tab]
# Complète automatiquement en "whoami"
Command history
# Voir les dernières commandes
history
# Voir les 10 dernières
history 10
# Réexécuter la dernière commande
!!
# Réexécuter la commande numéro 42
!42
# Rechercher dans l'historique
Ctrl + R puis tapez un mot
Hands-on exercise
Try these commands in order:
# 1. Qui suis-je ?
whoami
# 2. Sur quelle machine ?
hostname
# 3. Quelle date ?
date
# 4. Où suis-je ?
pwd
# 5. Afficher un message
echo "Je suis sur $(hostname) en tant que $(whoami)"
# 6. Voir l'historique
history 5
Use the ↑ and ↓ arrows to navigate the history rather than retyping the commands!
🔝 Back to table of contents
Key takeaways
- The terminal is more powerful than the graphical interface
- The prompt shows user@machine:directory$
$= normal user,#= root (be careful!)- The Tab key auto-completes
- Ctrl + C cancels a running command
- The history (up/down arrows) saves time
🔝 Back to table of contents
← Previous chapter | Next chapter: Navigating the file system →