Skip to main content

The interface and the Terminal


Table of contents

  1. Graphical interface vs command line
  2. Why the terminal is essential
  3. Opening and using the terminal
  4. Anatomy of the prompt
  5. First steps in the terminal


1 - Graphical interface vs command line

Two ways to interact with Linux

Comparison

AspectGraphical Interface (GUI)Command Line (CLI)
LearningIntuitiveRequires training
SpeedSlow (mouse)Fast (keyboard)
AutomationDifficultEasy (scripts)
ResourcesHeavyLightweight
Remote accessComplexSimple (SSH)
PrecisionLimitedTotal
ServersRarely availableAlways 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!

tip

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

ContextWhy the terminal?
ServersNo graphical interface
CloudSSH access only
DockerCommand-line commands
CI/CDAutomated pipelines
Kuberneteskubectl on the command line
AnsibleAutomated configuration

What the terminal allows

  1. Automate repetitive tasks
  2. Administer remote servers
  3. Diagnose problems quickly
  4. Process large amounts of data
  5. Integrate into DevOps pipelines
warning

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

PromptMeaning
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

SymbolMeaning
$Normal user
#Root user (administrator)
~The user's home directory
/Root of the file system
.Current directory
..Parent directory
danger

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

ShortcutAction
TabAuto-completion
/ Command history
Ctrl + CCancel the current command
Ctrl + LClear the screen (like clear)
Ctrl + AGo to the beginning of the line
Ctrl + EGo to the end of the line
Ctrl + UDelete the line before the cursor
Ctrl + RSearch 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
Tip

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 →