Final exam
Linux Command Line Basics
Before you start
- 20 questions, drawn at random from a pool of 35.
- Pass mark: 70%. Your final score is 30% practice + 70% exam.
- No time limit, but finish within 3 hours. You can move between questions before you submit.
- Failed? Review the lessons and try again: every attempt gets a new set of questions.
Question 1 of 20Choose one
Which component of a Linux system actually manages hardware, memory and running programs?
Question 2 of 20True or false
A prompt ending in # usually means you are working as the root user.
Question 3 of 20Sort into groups
In tail -n 100 -f /var/log/syslog, sort each part.
Tap an item, then tap its group (or drag it there).
Question 4 of 20Choose one
You remember running a long rsync command yesterday but not its exact options. What is the fastest way to get it back?
Question 5 of 20Choose one
You are in /srv/app/releases. Which path refers to /srv/app/shared/config.yml?
Question 6 of 20Match the pairs
Match each directory with its purpose.
Tap an answer, then tap the place where it belongs (or drag it there).
- /etc
- /var/log
- /home
- /tmp
Question 7 of 20True or false
cd with no arguments takes you to the root directory /.
Question 8 of 20Choose one
Which command renames draft.md to final.md in the current directory?
Question 9 of 20Select all that apply
A directory contains a.log, b.log, ab.log, a.txt and .c.log. Which files does ?.log match? Select all that apply.
Select all that apply.
Question 10 of 20What would you do?
What would you do?
A colleague is about to run rm -rf $DIR/* in a script, where DIR is set from user input. What is the main risk?
Question 11 of 20Choose one
Which command shows the last 20 lines of app.log and keeps printing new lines as they are added?
Question 12 of 20Fill in the blanks
Fill in the blanks
To search every file under /etc/nginx for the word listen, showing line numbers, run `grep listen /etc/nginx`.
Question 13 of 20Choose one
Which command lists only directories named backup anywhere under /srv?
Question 14 of 20Work it out
ls -l shows a file size of 3,145,728 bytes. How many MiB is that?
Question 15 of 20Put in order
Put these steps in order to extract site.tar.gz safely into a new directory.
Drag the items, or use the arrow buttons, to put them in order.
- tar -tzf site.tar.gz to list its contents
- mkdir -p /tmp/site
- tar -xzf site.tar.gz -C /tmp/site
Question 16 of 20Choose one
You are in vim, in insert mode, and type :wq. What happens?
Question 17 of 20Choose one
Which command saves the output of ls -l /var to listing.txt without erasing what is already in the file?
Question 18 of 20True or false
A pipe (|) passes both standard output and standard error to the next command by default.
Question 19 of 20Spot the mistake
A teammate wants to count how many requests in access.log returned status 404. Tap the stage that is wrong.
Question 20 of 20Choose one
Which pipeline lists the five most frequent values in the first column of data.txt, most frequent first?
Question 21 of 20Fill in the blanks
Fill in the blanks
To replace every dev.example.com with prod.example.com in app.conf directly in the file, run `sed 's/dev.example.com/prod.example.com/' app.conf`.
Question 22 of 20Match the pairs
Match each command to its output for a space-separated line alice 42 admin.
Tap an answer, then tap the place where it belongs (or drag it there).
- awk '{print $1}'
- awk '{print $2}'
- awk '{print $NF}'
- awk '{print NF}'
Question 23 of 20Work it out
What is the octal permission mode for rw-r-----?
Question 24 of 20Choose one
A file has mode -rwxr-x--- and is owned by ana:dev. User ben is not in the dev group. What can ben do with the file?
Question 25 of 20True or false
To delete a file, you need write permission on the directory that contains it.
Question 26 of 20Choose one
Which command gives only the owner permission to execute run.sh, leaving other permissions unchanged?
Question 27 of 20What would you do?
What would you do?
sudo echo "10.0.0.5 db" >> /etc/hosts fails with "Permission denied". Why, and what works?
Question 28 of 20Choose one
What does sudo apt update do on Ubuntu?
Question 29 of 20Choose one
A process ignores kill 5120. What is the reasonable next step after waiting a few seconds?
Question 30 of 20Match the pairs
Match each systemctl command to its effect.
Tap an answer, then tap the place where it belongs (or drag it there).
- systemctl start nginx
- systemctl enable nginx
- systemctl reload nginx
- systemctl status nginx
Question 31 of 20True or false
Variables you set and export in a terminal remain set after you close it and open a new one.
Question 32 of 20Choose one
With name="Ana Lee", which command creates a single directory called Ana Lee?
Question 33 of 20Choose one
Inside a script run as ./report.sh sales 2026, what is $2?
Question 34 of 20Select all that apply
Which statements about exit codes are true? Select all that apply.
Select all that apply.
Question 35 of 20Choose one