Day 1 Practice Exam Paper: Linux Foundations¶
Note: This is a practice paper written in the style of a hands-on, performance-based exam. It is not a real exam, does not reproduce real exam questions, and its point values are for self-assessment only. Confirm the actual exam format and objectives on Red Hat's official EX200 page.
Exam Information¶
| Item | Detail |
|---|---|
| Suggested time | 45 minutes |
| Total points | 50 (self-assessed) |
| Environment | One RHEL 9 or 10 practice VM |
| Account | A regular user with sudo access |
| Resources allowed | Manual pages (man) only. Do not use notes or the internet |
Instructions¶
- Work only on your practice VM.
- Perform every task from the command line.
- Tasks are graded on the end result, not on how you got there. Each file must contain exactly the content requested (no extra text unless stated).
- Unless stated otherwise, files go in
~/exam1. Task 1 creates this directory. - Do not delete anything outside
~/exam1. - When you finish, verify every task with a command such as
catorls. - Do not disable SELinux or the firewall.
Tasks¶
Task 1 (2 points)
Create a directory named exam1 in your home directory.
Task 2 (3 points)
Save the name of the user you are currently logged in as to ~/exam1/user.txt. The file must contain only the user name.
Task 3 (4 points)
Save the single line from the operating system identification file that contains the human-readable OS name and version (the PRETTY_NAME line) to ~/exam1/os.txt.
Task 4 (3 points)
Save the release of the kernel that is currently running to ~/exam1/kernel.txt.
Task 5 (3 points)
Save the hostname of the system to ~/exam1/host.txt.
Task 6 (3 points)
Save the path of your login shell to ~/exam1/shell.txt.
Task 7 (3 points)
Save the number of processing units available to the system to ~/exam1/cpus.txt.
Task 8 (3 points)
Save a listing of the top-level directories of the filesystem (the contents of /) to ~/exam1/toplevel.txt.
Task 9 (4 points)
Create ~/exam1/layers.txt containing the six layers of a Linux system, one per line, from the bottom to the top, in this exact order: hardware, operating system, kernel, shell, applications, user.
Task 10 (5 points)
Create ~/exam1/layers-map.txt with five lines in the format layer:command, where each command reports on that layer. Use these layers exactly: hardware, kernel, shell, user, operating system. Each command must run without error on your system.
Task 11 (4 points)
Determine whether /bin and /sbin are real directories or symbolic links. Save the long-format directory entries for both (not their contents) to ~/exam1/links.txt.
Task 12 (3 points)
Save the list of valid login shells for the system to ~/exam1/valid-shells.txt.
Task 13 (2 points)
Using the command line, create an empty directory named cli-folder inside ~/exam1.
Task 14 (2 points)
Create a copy of ~/exam1/layers.txt named layers.bak in the same directory.
Task 15 (3 points)
Add the line verified to the end of ~/exam1/user.txt without removing the existing content.
Task 16 (3 points)
Return to your home directory from wherever you are, and write your current directory path to ~/exam1/pwd.txt. The file must contain your home directory path.
Self-Check Before You Finish¶
- [ ] Every file exists in
~/exam1. - [ ] No file has extra, unrequested text (except Task 15's added line).
- [ ] You can explain each command you used.
- [ ] You did not change anything outside
~/exam1.
Answer Key and Marking Guide¶
Try the paper before reading this section. Output varies by system. Markers should check that file contents match what the system reports when the command is run again.
| Task | Solution | How to verify |
|---|---|---|
| 1 | mkdir ~/exam1 |
ls -d ~/exam1 |
| 2 | whoami > ~/exam1/user.txt |
cat ~/exam1/user.txt equals whoami |
| 3 | grep PRETTY_NAME /etc/os-release > ~/exam1/os.txt |
One PRETTY_NAME=... line |
| 4 | uname -r > ~/exam1/kernel.txt |
Equals uname -r |
| 5 | hostname > ~/exam1/host.txt |
Equals hostname |
| 6 | echo $SHELL > ~/exam1/shell.txt |
Typically /bin/bash |
| 7 | nproc > ~/exam1/cpus.txt |
Equals nproc |
| 8 | ls / > ~/exam1/toplevel.txt |
Matches ls / |
| 9 | printf "hardware\noperating system\nkernel\nshell\napplications\nuser\n" > ~/exam1/layers.txt |
Six lines, in order |
| 10 | See below | Each command runs |
| 11 | ls -ld /bin /sbin > ~/exam1/links.txt |
Lines start with l if links |
| 12 | cat /etc/shells > ~/exam1/valid-shells.txt |
Matches /etc/shells |
| 13 | mkdir ~/exam1/cli-folder |
ls -d ~/exam1/cli-folder |
| 14 | cp ~/exam1/layers.txt ~/exam1/layers.bak |
diff shows no difference |
| 15 | echo verified >> ~/exam1/user.txt |
Two lines: user name, then verified |
| 16 | cd then pwd > ~/exam1/pwd.txt |
Equals echo $HOME |
Task 10 solution
cat > ~/exam1/layers-map.txt << 'EOF'
hardware:lscpu
kernel:uname -r
shell:echo $SHELL
user:whoami
operating system:cat /etc/os-release
EOF
The quoted 'EOF' stops the shell from expanding $SHELL, so the file stores the command text. Other valid commands are accepted if they report on the named layer, for example free -h or lsblk for hardware, and hostnamectl for the operating system.
Notes on common mistakes
- Using
>in Task 15 instead of>>destroys the original user name. - Task 3 must contain only the one
PRETTY_NAMEline, not the whole file. - Task 8 expects the directory contents, not the string
/. - Task 11 needs
-d, otherwiselslists the target's contents, not the entry itself.
Scoring (self-assessment)
| Score | Level |
|---|---|
| 45 to 50 | Excellent. Move on |
| 35 to 44 | Good. Review missed tasks |
| Below 35 | Repeat the Day 1 lab and drills |