Quiz 1. Your first Linux terminal
Supported Versions: Ubuntu Server 24.04 LTS (primary), Rocky Linux 9 (alternate) Last Updated: September 15, 2026
Return to lesson | Course preparation
Choose an answer before opening its explanation. These scenarios use the disposable guest and private notebook from lesson 1. Commands in questions are for interpretation, not instructions to run on your host.
cat /etc/os-releaseidentifies Ubuntu 24.04, whileuname -rprints a different version number. Which explanation fits?- A) One of the commands must be broken because Linux has only one version number.
- B) Ubuntu is a library and
unameidentifies the terminal. - C) Ubuntu is a distribution;
uname -rreports the running kernel. Libraries and the shell are separate user-space components. - D) Installing a new editor always replaces the kernel.
Show Answer
Answer: C
Explanation: A distribution assembles a kernel, libraries, tools, repositories, and configuration. The kernel manages resources and exposes system calls; a library supplies reusable functions, some of which use those calls. Bash interprets commands in user space. Their versions need not match the distribution release. Debian is the family from which Ubuntu derives, but that relationship does not guarantee identical defaults.
Your working directory is your unique scratch root. You run
cp -i notes/draft.txt notes/copy.txt, followed bymv -i notes/copy.txt archive/saved.txt. What should exist after both succeed?- A) Only
archive/saved.txt;cpremoved the draft. - B)
notes/draft.txtandarchive/saved.txt;notes/copy.txtis gone. - C) All three files;
mvis another spelling of copy. - D) Files in
/notesand/archive, because relative paths start at/.
- A) Only
Show Answer
Answer: B
Explanation: cp leaves the source in place and creates a copy; mv changes the copy's location/name. Relative paths start at the working directory, which is why checking pwd matters. -i asks before overwriting an existing destination; it does not provide a general undo history. The saved copy can recover the draft later.
You want an empty practice file and run
touch notes/draft.txt, forgetting that it already contains your notes. What doestouchnormally do?- A) Empty the file and preserve its old timestamps.
- B) Create a directory with that name.
- C) Update the existing file's timestamps while preserving its contents.
- D) Move the file to your home directory.
Show Answer
Answer: C
Explanation: touch creates an empty file only when that path does not exist. On an existing file it normally changes access/modification timestamps, not its text. Use cat to inspect contents and ls -l to inspect size. This is also why the lesson starts in a unique directory rather than assuming a familiar filename is unused.
You have unsaved edits in vi and want to discard them. Which action is correct?
- A) Type
:q!at the Bash prompt. - B) Press Esc, type
:q!, and press Enter inside vi. - C) Press
i, then type:wq. - D) Press Ctrl+O, which saves and exits every editor.
- A) Type
Show Answer
Answer: B
Explanation: Esc returns vi to normal mode; :q! discards changes since the last save and exits. :wq saves and exits, while :q protects unsaved work by refusing to quit. In nano, Ctrl+O writes after filename confirmation and Ctrl+X exits. To discard unsaved nano changes, exit and decline its save prompt. Editor commands must be entered in the editor, not the shell.
A file's basic mode is
640(-rw-r-----). Which interpretation is correct?- A) The owner can read/write, the group can read, and others have no basic file permissions.
- B) Everyone can read/write because
6is the largest digit. - C) The owner can execute because
6means read plus execute. - D) Nobody can delete it because its execute bit is absent.
Show Answer
Answer: A
Explanation: Read=4, write=2, execute=1, so owner 6 means read+write and group 4 means read. Directory permissions and other controls affect access and deletion of directory entries; file write permission alone is not the deletion rule. To undo the lesson's chmod 600, restore the recorded original numeric mode, not an assumed 644.
Saving your notebook reports “Permission denied.” What is the best first response?
- A) Run a recursive permission change over
/home. - B) Start a root shell and repeat every remaining lesson command.
- C) Check
pwd,id, and the relevant directory/file ownership and permissions. - D) Disable the guest's firewall.
- A) Run a recursive permission change over
Show Answer
Answer: C
Explanation: You may be in the wrong directory or editing a file owned by another account. The notebook lives in your own scratch directory and normally needs no elevation. sudo elevates a permitted command, root by default; it is not a diagnosis. sudo whoami followed by whoami shows that a single elevated command does not permanently turn the normal shell into root.
On Ubuntu,
sudo apt updatecompletes successfully. Has it upgraded all installed packages and ensured nano is installed?- A) Yes;
updatemeans install every available update and missing editor. - B) No; it refreshed repository package indexes. A separate package transaction is needed to install or upgrade software.
- C) It changed only the currently running kernel.
- D) It enabled every newly discovered service.
- A) Yes;
Show Answer
Answer: B
Explanation: apt update refreshes information about available packages; apt install nano requests an installation and dependency resolution, while apt upgrade has a different purpose. On the guest, review a proposed transaction before confirming it. A local dpkg-query checks installed package records. Removing a package later is not an exact reversal of all dependency, cache, log, or configuration changes; the optional installation's full recovery uses the recorded VM snapshot.
A Rocky Linux 9 guest needs an editor. Which preparation path matches the lesson?
- A) Add Ubuntu repositories and run APT.
- B) Use
rpm -qfor local package inventory and DNF for installation;yumcompatibility exists, but there is no need to run both. - C) Use
systemctl install nanobecause all software is a service. - D) Rebuild the kernel before installing any package.
Show Answer
Answer: B
Explanation: Rocky uses RPM packages and DNF dependency management. The lesson's alternate editor packages are nano and vim-minimal; Ubuntu uses its own package family and package names. Distribution familiarity helps you select tools, but it is not permission to mix repositories or assume service/network defaults are identical.
What do
ps -p $$ -o pid,ppid,user,command thesleep 30exercise help you observe?- A) The shell's process identity and a foreground process that temporarily occupies the shell.
- B) Every package installed on the guest.
- C) A permanent service created by every shell command.
- D) A PID that will be the same on both VMs and after every reboot.
Show Answer
Answer: A
Explanation: $$ expands to the current Bash PID; PPID identifies its parent. A process is an executing instance of a program, whereas a package is software installed on disk. sleep either finishes after 30 seconds or can be interrupted with Ctrl+C. No service was enabled, and you should not use a PID copied from a document to terminate an unknown process.
systemctl is-active systemd-journald.servicereportsactive, whileis-enabledreportsstatic. Which conclusion is justified?
- A) The logging service has failed because it is not
enabled. - B) The unit is active now and has no ordinary enablement section; dependency/activation paths can start it.
- C)
staticmeans logs are permanently frozen. - D)
enablemust be run repeatedly until both commands return the same word.
Show Answer
Answer: B
Explanation: Runtime state and enablement are separate. start affects current operation, while enable creates enablement links and does not itself start a unit unless combined with --now. A static unit is not inherently broken. Read Loaded, Active, and relevant logs instead of changing system services to force a particular display.
- What does
sudo journalctl -b -u systemd-journald.service -n 20 --no-pagerselect?
- A) The first 20 lines of every log file from all boots.
- B) The latest 20 retained matching entries for that unit in the current boot, printed without a pager.
- C) All entries and then deletes the last 20.
- D) Only errors, because every journal message is an error.
Show Answer
Answer: B
Explanation: -b restricts the boot, -u the unit, and -n the number of recent entries. This is a read operation. Interpret timestamp and message context; an informational event is not a failure. No matching entries may reflect the filter or retention, and less-privileged readers may have incomplete visibility. Compare service status before concluding that logging is broken.
- You reopened the VM console, and
LAB_DIRis empty. What is the right cleanup procedure?
- A) Delete all directories whose names start with
network-beginner. - B) Assume the previous shell's current directory and run recursive removal.
- C) Restore
LAB_DIRfrom the exact recorded path, inspect it, remove only the named practice files, then remove empty directories. - D) Delete
/tmpto remove all possible scratch files.
Show Answer
Answer: C
Explanation: Variables do not automatically persist across sessions. The recorded unique path and explicit filenames bound the operation. rmdir refusing a nonempty directory is useful evidence: inspect leftover editor files or incomplete steps rather than escalating to broad deletion. A successful test ! -e "$LAB_DIR" returns status 0, confirming that specific path is absent.
Use any missed explanation to revisit the matching exercise in the lesson, then continue to addresses and interfaces.