Skip to main content

Review exercises


Table of contents​

  1. Validation quiz
  2. Exercise 1: Navigation
  3. Exercise 2: File manipulation
  4. Mini-project: Organize a directory tree
  5. Next steps


1 - Validation quiz​

Test your knowledge of the Linux fundamentals.

Questions​

Q1. Which command displays the current directory?

See the answer

pwd (Print Working Directory)


Q2. How do you create a folder with all its parents if they don't exist?

See the answer

mkdir -p chemin/vers/dossier

The -p (parents) option creates all the intermediate directories.


Q3. What is the difference between rm and rmdir?

See the answer
  • rmdir: deletes only empty directories
  • rm: deletes files, and with -r, directories (even non-empty ones)

Q4. How do you display the last 15 lines of a file?

See the answer

tail -n 15 fichier.txt or tail -15 fichier.txt


Q5. What does the ~ symbol mean in a path?

See the answer

The home directory of the current user.

Example: ~ = /home/username


Q6. How do you copy a directory with all its content?

See the answer

cp -r source/ destination/

The -r (recursive) option copies the content recursively.


Q7. Which command searches for "error" in all .log files?

See the answer

grep "error" *.log

With the -i option to ignore case: grep -i "error" *.log


Q8. How do you follow a log file in real time?

See the answer

tail -f /chemin/vers/fichier.log

The -f (follow) option displays new lines as they come.


Q9. In vim, how do you save and quit?

See the answer
  1. Press Esc to be in normal mode
  2. Type :wq then Enter

Or simply ZZ (uppercase) in normal mode.


Q10. What does the * wildcard do?

See the answer

It represents any characters (0 or more).

Example: *.txt = all files ending with .txt


Results​

ScoreLevel
10/10Excellent! You are ready for Linux 2
7-9/10Good! Review the points you missed
4-6/10Average. Reread the relevant chapters
0-3/10Start the course over from the beginning

πŸ” Back to table of contents​



2 - Exercise 1: Navigation​

Goal​

Navigate the Linux directory tree and explore the system.

Instructions​

Run the following commands and note the results:

# 1. Affichez votre rΓ©pertoire courant
pwd

# 2. Allez à la racine du système
cd /

# 3. Listez le contenu de la racine
ls -la

# 4. Allez dans /var/log
cd /var/log

# 5. Listez les fichiers par date (rΓ©cent en premier)
ls -lt

# 6. Revenez Γ  votre home
cd ~

# 7. CrΓ©ez un dossier de travail
mkdir exercices_linux

# 8. Entrez dedans
cd exercices_linux

# 9. VΓ©rifiez oΓΉ vous Γͺtes
pwd

Questions​

  1. How many directories are there at the root /?
  2. What is the most recent file in /var/log?
  3. What is the full path of your exercices_linux folder?

πŸ” Back to table of contents​



3 - Exercise 2: File manipulation​

Goal​

Create, copy, move, and delete files and folders.

Instructions​

# Assurez-vous d'Γͺtre dans ~/exercices_linux
cd ~/exercices_linux

# 1. CrΓ©ez cette structure :
# exercices_linux/
# β”œβ”€β”€ documents/
# β”œβ”€β”€ images/
# β”œβ”€β”€ scripts/
# └── temp/

mkdir documents images scripts temp

# 2. CrΓ©ez des fichiers de test
touch documents/rapport.txt documents/notes.txt
touch images/photo1.jpg images/photo2.jpg images/photo3.jpg
touch scripts/backup.sh scripts/deploy.sh
touch temp/fichier1.tmp temp/fichier2.tmp

# 3. VΓ©rifiez la structure
ls -R

# 4. Copiez rapport.txt dans temp/
cp documents/rapport.txt temp/

# 5. DΓ©placez tous les .tmp vers documents/
mv temp/*.tmp documents/

# 6. Renommez backup.sh en sauvegarde.sh
mv scripts/backup.sh scripts/sauvegarde.sh

# 7. Supprimez le dossier temp (maintenant vide)
rmdir temp

# 8. VΓ©rifiez le rΓ©sultat final
ls -R

Verification​

Your final structure should be:

exercices_linux/
β”œβ”€β”€ documents/
β”‚ β”œβ”€β”€ fichier1.tmp
β”‚ β”œβ”€β”€ fichier2.tmp
β”‚ β”œβ”€β”€ notes.txt
β”‚ └── rapport.txt
β”œβ”€β”€ images/
β”‚ β”œβ”€β”€ photo1.jpg
β”‚ β”œβ”€β”€ photo2.jpg
β”‚ └── photo3.jpg
└── scripts/
β”œβ”€β”€ deploy.sh
└── sauvegarde.sh

πŸ” Back to table of contents​



4 - Mini-project: Organize a directory tree​

Context​

You are a system administrator and must organize the files of a web project.

Goal​

Create a complete project structure and document it.

Instructions​

# CrΓ©ez le projet
cd ~
mkdir -p projet_web/{src,public,config,logs,backup}

# CrΓ©ez les sous-dossiers
mkdir -p projet_web/src/{css,js,images}
mkdir -p projet_web/public/assets
mkdir -p projet_web/config/{dev,prod}

# CrΓ©ez des fichiers
touch projet_web/src/css/style.css
touch projet_web/src/js/app.js
touch projet_web/public/index.html
touch projet_web/config/dev/settings.json
touch projet_web/config/prod/settings.json
touch projet_web/logs/.gitkeep
touch projet_web/README.md

# Ajoutez du contenu au README
cat > projet_web/README.md << EOF
# Projet Web

## Structure
- src/ : Code source
- public/ : Fichiers publics
- config/ : Configuration
- logs/ : Fichiers de log
- backup/ : Sauvegardes

## Auteur
Votre nom

## Date
$(date +%Y-%m-%d)
EOF

Verification​

# Affichez l'arborescence
ls -R projet_web/

# Ou avec tree (si installΓ©)
tree projet_web/

# Affichez le README
cat projet_web/README.md

Expected structure​

projet_web/
β”œβ”€β”€ README.md
β”œβ”€β”€ backup/
β”œβ”€β”€ config/
β”‚ β”œβ”€β”€ dev/
β”‚ β”‚ └── settings.json
β”‚ └── prod/
β”‚ └── settings.json
β”œβ”€β”€ logs/
β”‚ └── .gitkeep
β”œβ”€β”€ public/
β”‚ β”œβ”€β”€ assets/
β”‚ └── index.html
└── src/
β”œβ”€β”€ css/
β”‚ └── style.css
β”œβ”€β”€ images/
└── js/
└── app.js

Bonus​

# 1. Comptez le nombre de fichiers
find projet_web -type f | wc -l

# 2. Comptez le nombre de dossiers
find projet_web -type d | wc -l

# 3. Trouvez tous les fichiers .json
find projet_web -name "*.json"

# 4. CrΓ©ez une archive du projet
tar -czvf projet_web_backup.tar.gz projet_web/

πŸ” Back to table of contents​



5 - Next steps​

Congratulations!​

You have completed the Linux 1 - Fundamentals and First Steps course!

What you have learned​

Skills acquired​

SkillMastery
Navigate the file systemβœ…
Manage files and foldersβœ…
View and search in filesβœ…
Use nano and the basics of vimβœ…
Find helpβœ…

Next step: Linux 2​

In the Linux 2 - Basic Administration course, you will learn:

  • User and group management
  • Permissions and access rights
  • Package management
  • Processes and services
  • Environment variables
  • Redirections and pipes

Tips for making progress​

  1. Practice daily: Use the terminal rather than the graphical interface
  2. Create a lab: Install VMs to experiment
  3. Read the man pages: Get into the habit of consulting man
  4. Make mistakes: You learn by breaking things (in a VM!)
  5. Automate: As soon as you repeat a task, script it
TypeResource
PracticeLinux Journey
ReferenceArch Wiki
ExercisesOverTheWire Bandit
Book"The Linux Command Line" (free online)

Command summary​

CommandUsage
pwdDisplay the current directory
lsList the contents
cdChange directory
touchCreate an empty file
mkdirCreate a directory
cpCopy
mvMove / Rename
rmDelete
catDisplay the content
lessView with pagination
headBeginning of a file
tailEnd of a file
grepSearch for text
manDocumentation

πŸ” Back to table of contents​


← Previous chapter | Back to table of contents β†’