Test How Well You Really Know Bash and the Linux Command Line
Shell scripts look simple until one line does something you did not expect. Why does a variable set inside a while loop come back empty? Why does [ $x = “a b” ] complain about too many arguments? Why does set -e not stop a script when a command fails inside a function called from an if? Why does sort file > file leave you with an empty file? These practice tests check how well you can predict what Bash and the standard Linux tools really do, one short script at a time.
What this practice test course offers:
- 200 original multiple-choice questions in 4 practice tests of 50, grouped by topic
- Short scripts and command lines to reason about: what does it print, what is in the file afterwards, which exit status do you get, or why does it fail
- An explanation for every answer option, plus an overall explanation of the rule behind it
- Every script was run in a clean directory with GNU Bash and the GNU tools, so every answer matches what a real Linux system does
- Behaviour known to have changed in recent Bash and coreutils releases is kept out of the answers
Topics covered:
- Quoting, the order of expansions, word splitting with IFS and globbing (nullglob, extglob, globstar)
- Variables, parameter expansion, indexed and associative arrays, and integer arithmetic
- Exit statuses, test and [[ ]], case, set -e, set -u, pipefail and traps
- Redirection order, here-documents and here-strings, pipes and subshells, process substitution and file descriptors
- Functions and local scope, sourcing, positional parameters and getopts
- Text processing with grep, sed, awk, cut, sort, uniq, tr, wc and xargs
- Permissions, umask, special bits, hard and symbolic links, inodes and find
- Processes, signals and exit codes such as 126, 127 and 143, PATH and the environment, cron schedules, and systemd and journalctl basics
Assumed environment: GNU Bash 5 on Linux with GNU coreutils, grep, sed and findutils. awk questions use only POSIX awk features, so they behave the same in gawk and mawk. Where sorting or character classes matter, the scripts set LC_ALL=C.
Who should take this course?
- Developers, DevOps engineers and SREs who write shell scripts for builds, deployments and automation
- System administrators who want to stop guessing when a script behaves differently under cron or systemd
- Candidates preparing for interviews and Linux certification exams who want hands-on command-line practice
If you have never used a terminal, start with a Linux command-line fundamentals course and come back here to test yourself.
How to use the tests: take one test at a time, then read every explanation, including the ones for questions you answered correctly. Try the scripts in your own terminal, then retake a test a few days later to check that the rules have stuck.
This course is independent and is not affiliated with or endorsed by the Linux Foundation, the GNU Project or the Free Software Foundation.








