Career Employer

Your FREE CompTIA Linux+ (XK0-006) Practice Test 2026 – 250+ Q&A

Realistic CompTIA Linux+ XK0-006 practice questions across all five official exam domains, with instant scoring and answer explanations.

How ready are you?

To find us again, just search “Career Employer Linux+”

By
Linux+ exam by the numbersStandard mode

Where the Linux+ exam's points come from

CompTIA's official outline weights, the exam rules and our 252 free practice questions mapped domain by domain. Use it to plan your study hours.

  • Certifying Body:CompTIA
  • Exam Code:XK0-006 (V8; current version, launched July 15, 2025)
  • Total Questions:Maximum of 90 (multiple-choice and performance-based)
  • Recommended Experience:About 12 months with Linux servers; A+, Network+, or Server+ recommended
  • Exam Cost:About $369 USD (approximate; verify current pricing with CompTIA)
  • Recertification:Valid for 3 years; renew via CompTIA continuing education (CEUs)
Facts from CompTIA's official exam outline and rules
90 min
Time Limit
720
Passing Score

Where the Linux+ points are

CompTIA's official weight for each of the five domains. Hover or tap a domain to see how many questions that means on your exam.

See these numbers as a table
Weights from CompTIA's Linux+ exam outline. Questions on your exam = weight × 90 questions, rounded. Practice questions: Career Employer's Linux+ bank.
DomainOfficial weightQuestions on your examOur practice questions
System Management23%2153
Services and User Management20%1838
Security18%1640
Automation, Orchestration, and Scripting17%1561
Troubleshooting22%2060

What to do: System Management is the biggest domain at 23%, which means 21 of your questions. Automation, Orchestration, and Scripting is the smallest at 17%.

Career Employer study data · Linux+ exam

What Linux+ studiers got right (and wrong) so far

2,914 first-try answers on our free Linux+ practice questions. Each part below switched on by itself once it had enough people behind it.[5]

Data through Nov 20, 2026 · updates daily
88%
accuracy on the second try, up from 67.2%

Where Linux+ points are lost

Out of 100 questions on a real exam, how many a typical studier would miss in each section. Accuracy alone hides this: a big section with average accuracy costs more points than a small, hard one.

Not shown yet (below our sample-size minimum): Security.

See these numbers as a table
First-try answers from Linux+ studiers on Career Employer, through Nov 20, 2026. Weights from CompTIA's Linux+ content outline.
SectionExam weightFirst-try accuracyPoints lost per 100First-try answersStudiers
Services and User Management20%61.6%7.751053
System Management23.3%67.5%7.673855
Troubleshooting22.2%68.9%6.964053
Automation, Orchestration, and Scripting16.7%70.8%4.955152

Split your study time

Your hours, divided by CompTIA's domain weights.

System Management
14 hrs
Services and User Management
12 hrs
Security
11 hrs
Automation, Orchestration, and Scripting
10 hrs
Troubleshooting
13 hrs

More Linux+ student data is on its way

We’ve logged 2,914 first-try answers on our Linux+ questions so far. This section switches to real Linux+ student results by itself once each part has enough people behind it:

What switches onNeeds
Headline numbers150 studiers
Accuracy by domain300 answers + 50 people per domain
First full exam score100 full exams
Finish rate150 people starting

Then it shows you vs everyone and question difficulty.

Linux+ study activity, week by week

How much Linux+ studying happens on Career Employer each week. Hover or tap a week for details.

See these numbers as a table
Site analytics, week of Jul 6 through Nov 18, 2026 (the latest week is partial).
Week ofQuestions answeredPractice tests startedFlashcard sessions
Nov 16 (partial)10320
Nov 9133141
Nov 2139110
Oct 26289154
Oct 19193122
Oct 12000
Oct 517190
Sep 2815560
Sep 2127087
Sep 1411090
Sep 711030
Aug 3110080
Aug 24610309
Aug 17182181
Aug 1022490
Aug 3475263
Jul 2724581
Jul 20383–
Jul 1300–
Jul 600–

Source: anonymous first-try answers on Career Employer Linux+ practice tests, Aug 29, 2026 – Nov 20, 2026. Staff traffic, repeats and peeked answers excluded. Our practice questions are written to the official outline, not the official exam; self-selected sample; a studier is one browser.

Weights and rules from CompTIA's published Linux+ exam outline and certification pages. Practice-question counts from Career Employer's Linux+ bank. Fees and requirements can change; check CompTIA before you register.

The CompTIA Linux+ exam, code XK0-006 (V8), validates the hands-on skills a system administrator needs to configure, manage, secure, automate, and troubleshoot Linux servers across on-premises and cloud environments.[1] These free Linux+ practice questions and test prep mirror the official XK0-006 objectives so you practice the way the real exam is built.[3] To round out your prep, pair these with our free study guide, flashcards, and cheat sheet.

CompTIA Linux+ is one of the 14 CompTIA certifications — explore all our CompTIA practice tests to compare and prep across the whole family.

What Is on the Linux+ Exam?

The Linux+ XK0-006 exam covers five domains: System Management (23%), Troubleshooting (22%), Services and User Management (20%), Security (18%), and Automation, Orchestration and Scripting (17%).[3]

System Management is the largest section, covering the boot process, kernel modules, storage (LVM and RAID), filesystems, networking, and virtualization. The V8 update adds modern automation and orchestration tooling (Ansible, Puppet), Git, and scripting. Our full practice test is weighted to match.

CompTIA Linux+ practice test — practice questions by domain with answer explanations

Practice Questions by Domain

Use Start Test for a full weighted XK0-006 simulation, or open the hub and pick a single domain to drill your weak area. After each full exam, your results show a per-domain breakdown so you know exactly where to focus — most candidates need the most reps on System Management and command-line Troubleshooting.

What Are the Requirements to Take Linux+?

Linux+ has no mandatory prerequisites — anyone may register and sit for the exam. CompTIA recommends, but does not require, about 12 months of hands-on experience working with Linux servers, along with CompTIA A+, Network+, or Server+ certifications (or comparable knowledge).[1]

Because the exam is heavy on command-line tasks and performance-based questions, practical administration experience on a real or virtual Linux system is strongly advised.

How Do You Register for the Linux+ Exam?

You register for Linux+ through CompTIA and schedule your exam with Pearson VUE, either at a physical testing center or via OnVUE online proctoring.[4] Purchase an XK0-006 voucher from the CompTIA Store (or an authorized reseller), create or sign in to your CompTIA account, then book a date and delivery method through Pearson VUE.

Exam pricing is approximately $369 USD but varies by region and promotion, so verify the current voucher price on CompTIA's site before you buy.

What Is the Passing Score for Linux+?

The passing score for Linux+ XK0-006 is 720 on a scaled range of 100 to 900.[1]

The exam blends multiple-choice questions with performance-based questions (PBQs) that drop you into simulated Linux environments to demonstrate hands-on command-line skills; PBQs typically carry more weight than standard multiple-choice items.

Because scoring is scaled rather than a simple percentage correct, there is no fixed number of questions you must answer correctly. Your result is reported as pass or fail immediately after testing.

How Hard Is Linux+? (Pass Rate)

Linux+ is an intermediate-level, hands-on exam that assumes real command-line fluency. CompTIA does not publish official pass-rate statistics; industry and training-provider estimates commonly place the first-attempt pass rate in roughly the 60-70% range, with the command-line depth of System Management, the Troubleshooting scenarios, and the performance-based questions cited as the most common stumbling blocks.[1] Treat any specific figure as an unofficial estimate.

~60-70%
Est. pass rate
unofficial estimate
23%
System Management
largest domain

The takeaway: practice daily in a live Linux terminal — permissions, services, storage, networking, and Bash scripting — and drill until you’re consistently scoring above target on full-length practice before you book your exam date.

On Career Employer, Linux+ students miss Services and User Management most (62% right on the first try)[5] — see the Linux+ student data above.

What Should You Expect on Linux+ Exam Day?

Arrive at your Pearson VUE test center at least 15 minutes early to check in — bring a valid, unexpired government-issued photo ID whose name matches your CompTIA registration.[4]You’ll store phones and personal items in a locker; no notes are allowed.

A short tutorial precedes the exam, then you have 90 minutes to answer up to 90 multiple-choice and performance-based questions. The PBQs drop you into simulated Linux environments where you must run and interpret real commands, so the clock is tight — budget your time and don’t get stuck.

If you test via OnVUE online proctoring, expect a workspace scan and ID check. CompTIA reports a pass/fail result immediately. Having simulated the full timing with practice tests makes that 90-minute clock feel routine.

How to Use This Linux+ Practice Test

  • Recreate exam conditions. Take the full test timed, with no notes.[4]
  • Diagnose, then drill. Use a full XK0-006 simulation to find weak domains, then drill them.
  • Prioritize the command line. System Management and Troubleshooting are the biggest score-movers.
  • Learn the why. Read every explanation — understanding beats memorizing.
  • Practice in a real terminal. A live Linux box is the best prep for the performance-based questions.

Why Get Linux+ Certified?

Linux+ validates the cross-distribution administration skills employers rely on for sysadmin, DevOps, and cloud engineering roles, and the V8 update keeps it current with modern automation tooling.[1] These free Linux+ practice tests are the most efficient way to get there.

Conclusion

Passing XK0-006 comes down to knowing your command line, services, security, and automation tooling cold. Use this free CompTIA Linux+ practice test to find your weak domains, drill them to mastery, and reinforce them with our study guide, flashcards, and cheat sheet. On Career Employer, Linux+ students lose the most points on Services and User Management (62% correct on the first try), so start your drilling there.[5]

CompTIA Linux+ Practice Test FAQ

Linux+ is CompTIA's Linux system administration certification, administered by CompTIA and delivered through Pearson VUE. The current XK0-006 (V8) version validates the skills to configure, manage, secure, automate, and troubleshoot Linux servers. XK0-006 launched July 15, 2025 and replaced the prior XK0-005 version.

What changed on this page

Every real change, with the date.

  1. Interactive charts added. Built from the official outline and our question bank.
  2. 252 questions rewritten.
  3. 1 question corrected.
  4. 129 new practice questions. The bank now has 252 questions.
Career Employer Linux+ practice-test data, through Nov 20, 2026 · 55+ students
Every published Career Employer Linux+ practice-test number, with its sample size, source and date
MetricValuenStudentsSourceData through
First-try accuracy: Services and User Management (20% of the exam; costs 7.7 of every 100 exam points)61.6%510 answers53current question setNov 20, 2026
First-try accuracy: System Management (23.3% of the exam; costs 7.6 of every 100 exam points)67.5%738 answers55current question setNov 20, 2026
First-try accuracy: Troubleshooting (22.2% of the exam; costs 6.9 of every 100 exam points)68.9%640 answers53current question setNov 20, 2026
First-try accuracy: Automation, Orchestration, and Scripting (16.7% of the exam; costs 4.9 of every 100 exam points)70.8%551 answers52current question setNov 20, 2026

Sections below our sample-size minimum (not published yet): Security.

First attempt at each question only; repeats, answers after revealing the explanation, bots and staff excluded. Aug 29, 2026 – Nov 20, 2026. Our practice questions written to the official outline, not the official exam; self-selected sample; a student is one browser. Free to reuse under CC BY 4.0 — cite “Career Employer practice-test data, careeremployer.com/data”.

Linux+ question bank

All 252 questions, by domain

A reference copy of every question in this practice test. Each answer stays hidden until you choose to show it. To practice with scoring, timing and your readiness score, use Start Test at the top of the page.

System Management (53)

  1. Which command is used to update the package database in a Debian-based system?

    • A.apt-get upgrade
    • B.yum check-update
    • C.yum upgrade
    • D.apt-get update
    Show answerHide answer

    Correct answer: apt-get update

    apt-get update re-reads the repositories listed in /etc/apt/sources.list and refreshes the local package database without installing anything. apt-get upgrade installs newer versions of packages that are already installed, a separate step that relies on a fresh database. yum check-update refreshes metadata and lists available updates, and yum upgrade upgrades installed packages, but both belong to Red Hat-family systems, not to a Debian-based one.

  2. In Linux, what is the purpose of the 'nohup' command?

    • A.To kill a process after the time limit expires
    • B.To keep a process alive after the user logs out
    • C.To run a process once at a later scheduled time
    • D.To start a process at a lower priority level
    Show answerHide answer

    Correct answer: To keep a process alive after the user logs out

    nohup runs a command so that it ignores the hangup signal (SIGHUP) sent when the terminal closes, which is how it manages 'To keep a process alive after the user logs out'. 'To kill a process after the time limit expires' describes the timeout command, 'To run a process once at a later scheduled time' describes at, and 'To start a process at a lower priority level' describes nice.

  3. Which file in Linux contains system-wide environment variables?

    • A./etc/environment
    • B.~/.config/environment.d
    • C./etc/bashrc
    • D.~/.bashrc
    Show answerHide answer

    Correct answer: /etc/environment

    '/etc/environment' is read by pam_env at login and holds plain VAR=value lines that apply system-wide, to every user and process rather than to one shell. '/etc/bashrc' is a Bash startup script on Red Hat-based systems, and its own header says it is for system-wide functions and aliases, not environment variables. '~/.config/environment.d' and '~/.bashrc' live in one user's home directory, so they set variables for that user alone.

  4. How is a Kernel module loaded manually in Linux?

    • A.With the 'insmod' command
    • B.With the 'rmmod' command
    • C.With the 'lsmod' command
    • D.With the 'depmod' command
    Show answerHide answer

    Correct answer: With the 'insmod' command

    insmod inserts a single module file into the running kernel by hand, so "With the 'insmod' command" is right; modprobe can also load modules and resolves their dependencies for you. "With the 'rmmod' command" does the opposite and unloads a module, "With the 'lsmod' command" only lists the modules already loaded, and "With the 'depmod' command" rebuilds the modules.dep dependency list without loading anything.

  5. Which command in Linux is used to display the status of a RAID array?

    • A.mdadm --detail
    • B.smartctl --scan
    • C.mdadm --create
    • D.smartctl --info
    Show answerHide answer

    Correct answer: mdadm --detail

    mdadm --detail (for example, mdadm --detail /dev/md0) prints a software RAID array's state, RAID level and its active, failed and spare devices. mdadm --create builds a new array from member disks rather than reporting on an existing one. smartctl --scan only lists the drives smartctl can find, and smartctl --info prints the identity details of a single physical drive, so neither shows the status of the RAID array.

  6. What is the purpose of the 'tar' command in Linux?

    • A.To create or extract archives of files
    • B.To set or update timestamps of files
    • C.To add or remove permission bits of files
    • D.To report or sum disk usage of files
    Show answerHide answer

    Correct answer: To create or extract archives of files

    tar (tape archive) is used 'To create or extract archives of files': tar -cf bundles files into one archive and tar -xf extracts them again. 'To set or update timestamps of files' describes touch, 'To add or remove permission bits of files' describes chmod, and 'To report or sum disk usage of files' describes du.

  7. In Linux, which file should be edited to change the system's hostname permanently?

    • A./proc/sys/kernel/hostname
    • B./etc/hosts
    • C./proc/sys/kernel/domainname
    • D./etc/hostname
    Show answerHide answer

    Correct answer: /etc/hostname

    The static hostname is stored in '/etc/hostname', which is read at every boot (hostnamectl set-hostname writes the same file), so editing it makes the change permanent. Writing to '/proc/sys/kernel/hostname' changes the name only in the running kernel, and the change is lost at reboot. '/etc/hosts' maps names to IP addresses for local lookups and does not set the machine's own name, and '/proc/sys/kernel/domainname' holds the NIS domain name, not the hostname.

  8. In Linux, what is the primary purpose of the '/etc/fstab' file?

    • A.To list shared directories and their clients
    • B.To list hostnames and their network addresses
    • C.To list filesystems and their mount points
    • D.To list encrypted volumes and their key files
    Show answerHide answer

    Correct answer: To list filesystems and their mount points

    /etc/fstab (the filesystem table) is used 'To list filesystems and their mount points': each line gives a device, its mount point, type and options, and mount reads it at boot. 'To list encrypted volumes and their key files' describes /etc/crypttab, 'To list hostnames and their network addresses' describes /etc/hosts, and 'To list shared directories and their clients' describes /etc/exports, the NFS export table.

  9. Which command is used to modify the priority of a running process in Linux?

    • A.nice
    • B.pstree
    • C.renice
    • D.kill
    Show answerHide answer

    Correct answer: renice

    'renice' changes the nice value (scheduling priority) of a process that is already running, for example renice -n 5 -p 1234. 'nice' sets the priority only when it starts a new command, so it cannot alter a running process. 'pstree' only displays processes as a parent-child tree, and 'kill' sends a process a signal, such as SIGTERM, without touching its priority.

  10. In Linux, what is the function of the '/var' directory?

    • A.It holds personal data such as notes and dotfiles
    • B.It holds variable data such as logs and mailboxes
    • C.It holds system settings such as fstab and passwd
    • D.It holds system programs such as perl and editors
    Show answerHide answer

    Correct answer: It holds variable data such as logs and mailboxes

    /var stores data that changes while the system runs, so 'It holds variable data such as logs and mailboxes' is right (/var/log, /var/spool/mail, caches and package databases). 'It holds system settings such as fstab and passwd' describes /etc, 'It holds personal data such as notes and dotfiles' describes /home, and 'It holds system programs such as perl and editors' describes /usr, home of /usr/bin.

  11. Which command in Linux is used to display the current Linux Kernel version?

    • A.uname -m
    • B.uname -r
    • C.uname -n
    • D.uname -s
    Show answerHide answer

    Correct answer: uname -r

    'uname -r' prints the kernel release of the running kernel, such as 5.14.0-362.el9.x86_64, which is the version figure administrators check. 'uname -m' prints the machine hardware name (for example x86_64), 'uname -n' prints the network node hostname, and 'uname -s' prints only the kernel name, Linux, with no version.

  12. What is the primary purpose of the '/boot' directory in a Linux system?

    • A.To hold the kernel image and startup files
    • B.To hold the host settings and service files
    • C.To hold the temporary data and socket files
    • D.To hold the system journals and audit files
    Show answerHide answer

    Correct answer: To hold the kernel image and startup files

    /boot exists 'To hold the kernel image and startup files': the vmlinuz kernel, the initramfs and the GRUB boot loader files the system needs before the root filesystem is mounted. 'To hold the host settings and service files' describes /etc, the host-specific configuration directory where /etc/systemd/system keeps local unit files, 'To hold the temporary data and socket files' describes /tmp, and 'To hold the system journals and audit files' describes /var/log, home of /var/log/journal and /var/log/audit.

  13. How is the 'rsync' command primarily used in Linux?

    • A.For scheduling scripts and backups
    • B.For cloning raw disks and partitions
    • C.For formatting raw disks and volumes
    • D.For syncing files and making backups
    Show answerHide answer

    Correct answer: For syncing files and making backups

    rsync copies only the differences between a source and a destination, locally or over SSH, so it is mainly used 'For syncing files and making backups'. 'For scheduling scripts and backups' describes cron, which can run rsync on a timetable but is a separate tool. 'For cloning raw disks and partitions' describes dd, which copies block by block, and 'For formatting raw disks and volumes' describes mkfs, which builds a new filesystem.

  14. In Linux, what is the function of the '/etc/sysctl.conf' file?

    • A.To set runtime kernel parameters
    • B.To set kernel module parameters
    • C.To set account creation defaults
    • D.To set account resource limits
    Show answerHide answer

    Correct answer: To set runtime kernel parameters

    /etc/sysctl.conf is used 'To set runtime kernel parameters' such as net.ipv4.ip_forward; the values are applied at boot or with sysctl -p and can be changed while the system runs. 'To set kernel module parameters' is done with options lines in /etc/modprobe.d/, 'To set account creation defaults' is the job of /etc/login.defs, and 'To set account resource limits' is done in /etc/security/limits.conf.

  15. Which file in Linux should be edited to permanently set system-wide environmental variables?

    • A./etc/bash.bashrc
    • B./etc/skel/.bashrc
    • C./etc/os-release
    • D./etc/environment
    Show answerHide answer

    Correct answer: /etc/environment

    '/etc/environment' holds simple VAR=value lines that pam_env applies at every login, so variables set there are permanent and system-wide for all users and shells. '/etc/bash.bashrc' is read only by interactive Bash shells, so programs started any other way miss what it sets. '/etc/skel/.bashrc' is only a template copied into the home directory of each new account, so editing it changes nothing for existing users, and '/etc/os-release' only describes the distribution (NAME, VERSION_ID and so on) for scripts to read; it is not loaded into anyone's environment.

  16. In Linux, what is the purpose of the '/boot' directory?

    • A.To store system settings and startup scripts
    • B.To store kernel images and bootloader files
    • C.To store temporary files and runtime sockets
    • D.To store system journals and session records
    Show answerHide answer

    Correct answer: To store kernel images and bootloader files

    /boot is used 'To store kernel images and bootloader files': vmlinuz, the initramfs and the GRUB files that load them. 'To store system settings and startup scripts' describes /etc, including /etc/init.d, 'To store temporary files and runtime sockets' describes /tmp, and 'To store system journals and session records' describes /var/log, where the journal and wtmp live.

  17. Which Linux command is used to change the default runlevel of the system?

    • A.systemctl isolate
    • B.systemctl switch-root
    • C.systemctl set-default
    • D.systemctl disable
    Show answerHide answer

    Correct answer: systemctl set-default

    On a systemd system the runlevel is a target, and 'systemctl set-default' (for example, systemctl set-default multi-user.target) changes the target the machine boots into. 'systemctl isolate' switches the running system to a target now but leaves the default for the next boot unchanged. 'systemctl disable' only stops one unit from starting at boot, and 'systemctl switch-root' hands control from the initramfs to the real root filesystem during start-up.

  18. In Linux, which file controls the automatic mounting of filesystems at boot?

    • A./etc/mtab
    • B./etc/modules
    • C./etc/fstab
    • D./etc/inittab
    Show answerHide answer

    Correct answer: /etc/fstab

    /etc/fstab lists each filesystem with its mount point, type and options; at boot systemd (or mount -a on older init systems) reads it and mounts those filesystems automatically. /etc/mtab only records what is mounted right now; /etc/modules lists kernel modules that Debian-based systems load at boot; /etc/inittab set the default runlevel and the processes started by SysV init - none of them defines boot-time mounts.

  19. In Linux, which command is used to display the current network configuration?

    • A.nslookup
    • B.tcpdump
    • C.ping
    • D.ifconfig
    Show answerHide answer

    Correct answer: ifconfig

    'ifconfig' with no arguments prints every active interface with its IP address, netmask, MAC address and traffic counters, which is the current network configuration (newer distributions give the same view with ip addr). 'nslookup' queries DNS for a name, 'tcpdump' captures packets crossing an interface, and 'ping' tests whether a remote host answers; none of them reports the local interface settings.

  20. Which command in Linux is used to list the contents of a directory, including hidden files?

    • A.ls -l
    • B.ls -a
    • C.ls -r
    • D.ls -t
    Show answerHide answer

    Correct answer: ls -a

    'ls -a' (--all) lists every entry, including hidden names that begin with a dot. 'ls -l' gives the long format with permissions, owner and size, 'ls -r' reverses the sort order, and 'ls -t' sorts by modification time; without -a, none of them shows hidden files.

  21. What is the main purpose of the tar command in Linux?

    • A.Compressing and expanding files
    • B.Copying and syncing directories
    • C.Creating and unpacking archives
    • D.Cloning and imaging partitions
    Show answerHide answer

    Correct answer: Creating and unpacking archives

    tar (tape archive) bundles files and directories into a single archive file and extracts them again, so its main purpose is 'Creating and unpacking archives'. Compression is a separate job that tar hands to gzip, bzip2 or xz through -z, -j or -J, so 'Compressing and expanding files' describes gzip; 'Copying and syncing directories' describes rsync, and 'Cloning and imaging partitions' describes dd.

  22. Which command in Linux is primarily used for viewing the contents of a file on the terminal?

    • A.ls
    • B.cat
    • C.stat
    • D.file
    Show answerHide answer

    Correct answer: cat

    'cat' (concatenate) writes a file's contents to standard output, which is the usual way to view a short file on the terminal. 'ls' lists directory entries without opening them, 'stat' prints a file's metadata such as size, permissions and timestamps, and 'file' reports what kind of data a file holds rather than showing it.

  23. Which Linux command is used to determine the type of a file (text, executable, image, etc.)?

    • A.type
    • B.file
    • C.head
    • D.stat
    Show answerHide answer

    Correct answer: file

    'file' examines a file's contents and magic numbers and reports what it is, such as ASCII text, ELF executable or PNG image, regardless of its name. 'type' is a Bash builtin that tells you how a command name would be interpreted (alias, builtin or path), 'head' prints the first lines of a file without identifying what they are, and 'stat' reports metadata whose 'regular file' is the inode type, not whether the data is text, an executable or an image.

  24. In Linux, which command is used to display the status of a network interface and to enable or disable network interfaces?

    • A.ethtool
    • B.ifconfig
    • C.tcpdump
    • D.iwconfig
    Show answerHide answer

    Correct answer: ifconfig

    ifconfig displays the status of network interfaces (addresses, flags such as UP and RUNNING, counters) and can enable or disable one with 'ifconfig eth0 up' or 'ifconfig eth0 down'; on current distributions the iproute2 equivalent is 'ip link set eth0 up'. ethtool reports and tunes a network card's link speed, duplex and driver settings but cannot bring an interface up or down; tcpdump captures the packets passing through an interface without showing or changing its state; and iwconfig sets wireless-only parameters such as the ESSID, mode and channel rather than enabling or disabling interfaces.

  25. A trainer is asked to put the Linux boot process in correct order. After the hardware powers on, which sequence of handoffs is correct on a modern UEFI system?

    • A.GRUB runs POST and starts UEFI, UEFI loads the kernel and initramfs, the kernel mounts the root filesystem, then systemd starts as PID 1
    • B.UEFI runs POST and starts GRUB, GRUB loads the kernel and initramfs, systemd mounts the root filesystem, then the kernel starts as PID 1
    • C.UEFI runs POST and starts GRUB, GRUB loads the kernel and initramfs, the kernel mounts the root filesystem, then systemd starts as PID 1
    • D.GRUB runs POST and starts UEFI, UEFI loads the kernel and initramfs, systemd mounts the root filesystem, then the kernel starts as PID 1
    Show answerHide answer

    Correct answer: UEFI runs POST and starts GRUB, GRUB loads the kernel and initramfs, the kernel mounts the root filesystem, then systemd starts as PID 1

    The firmware always runs first and systemd last: "UEFI runs POST and starts GRUB, GRUB loads the kernel and initramfs, the kernel mounts the root filesystem, then systemd starts as PID 1" is the correct chain, with the initramfs supplying the drivers the kernel needs to reach the real root filesystem before it executes systemd. "GRUB runs POST and starts UEFI, UEFI loads the kernel and initramfs, the kernel mounts the root filesystem, then systemd starts as PID 1" reverses firmware and boot loader: POST is a firmware self-test and GRUB is launched by UEFI, not the other way round. "UEFI runs POST and starts GRUB, GRUB loads the kernel and initramfs, systemd mounts the root filesystem, then the kernel starts as PID 1" reverses kernel and init: the kernel is not a process, and PID 1 is the first user-space process it starts. "GRUB runs POST and starts UEFI, UEFI loads the kernel and initramfs, systemd mounts the root filesystem, then the kernel starts as PID 1" makes both of those reversals.

  26. An administrator needs to load the kernel module 'vfat' along with any modules it depends on, using the dependency map the system has already built. Which command is the preferred tool for this?

    • A.depmod vfat.ko
    • B.modprobe vfat
    • C.insmod vfat.ko
    • D.rmmod vfat
    Show answerHide answer

    Correct answer: modprobe vfat

    modprobe vfat loads the vfat module by name and, using the modules.dep map that depmod has already built, first loads every module it depends on (such as fat), which is why it is the preferred tool. depmod vfat.ko loads nothing: depmod only builds the dependency map, and here it stops with 'Bad version passed' because a bare first argument must be a kernel version; insmod vfat.ko inserts just the one file it is given and resolves no dependencies, so it fails if fat is not already loaded; and rmmod vfat unloads a module instead of loading it.

  27. An administrator wants to see every kernel module currently loaded in memory along with its size and how many other modules depend on it. Which command provides this?

    • A.lspci
    • B.depmod
    • C.insmod
    • D.lsmod
    Show answerHide answer

    Correct answer: lsmod

    lsmod formats the contents of /proc/modules, listing every module currently loaded with its size in memory and its 'Used by' count and list of the modules that depend on it. lspci lists PCI devices (with -k it also names the kernel driver and modules for each device), not every loaded module with its size and users; depmod rebuilds the modules.dep dependency database rather than displaying anything loaded; and insmod inserts a module file into the kernel.

  28. An administrator must cleanly unload the kernel module 'pcspkr' and any modules that exist only to support it, in the correct order. Which command is the safest choice?

    • A.modprobe -r pcspkr
    • B.rmmod -v pcspkr
    • C.modprobe -n pcspkr
    • D.rmmod -f pcspkr
    Show answerHide answer

    Correct answer: modprobe -r pcspkr

    modprobe -r pcspkr unloads the module and then any modules it depended on that are no longer in use, handling the order automatically, which makes it the safe, clean choice. rmmod -v pcspkr removes only the named module (verbosely) and ignores dependencies; modprobe -n pcspkr is a dry run that goes through the motions of loading the module without changing anything, and removes nothing; and rmmod -f pcspkr forces removal even when the module is in use, which can crash the system and is the opposite of a clean unload.

  29. An administrator just attached a new disk /dev/sdb and wants to use it under LVM. Which ordered sequence correctly initializes the disk and adds its space to an existing volume group named vg_data?

    • A.pvresize /dev/sdb, then vgextend vg_data /dev/sdb
    • B.pvcreate /dev/sdb, then lvextend vg_data /dev/sdb
    • C.pvcreate /dev/sdb, then vgextend vg_data /dev/sdb
    • D.pvresize /dev/sdb, then lvextend vg_data /dev/sdb
    Show answerHide answer

    Correct answer: pvcreate /dev/sdb, then vgextend vg_data /dev/sdb

    pvcreate /dev/sdb, then vgextend vg_data /dev/sdb is the correct order: pvcreate writes the LVM label that turns the disk into a physical volume, and vgextend adds that physical volume's space to the existing volume group. pvresize /dev/sdb, then vgextend vg_data /dev/sdb fails at the first step, because pvresize only changes the size of a disk that is already a physical volume. pvcreate /dev/sdb, then lvextend vg_data /dev/sdb fails at the second step, because lvextend grows a logical volume and cannot add a disk to a volume group. pvresize /dev/sdb, then lvextend vg_data /dev/sdb makes both mistakes.

  30. After running lvextend -L +10G /dev/vg_data/lv_app on a mounted ext4 logical volume, an administrator finds the filesystem still shows the old size. Which command grows the ext4 filesystem to use the new space without unmounting it?

    • A.xfs_growfs /dev/vg_data/lv_app
    • B.resize2fs /dev/vg_data/lv_app
    • C.dumpe2fs /dev/vg_data/lv_app
    • D.xfs_repair /dev/vg_data/lv_app
    Show answerHide answer

    Correct answer: resize2fs /dev/vg_data/lv_app

    resize2fs /dev/vg_data/lv_app grows a mounted ext2/ext3/ext4 filesystem online; with no size given it expands the filesystem to fill the enlarged logical volume. xfs_growfs /dev/vg_data/lv_app is the near miss: it grows XFS filesystems only, so it does not apply to ext4. dumpe2fs /dev/vg_data/lv_app only prints the ext4 superblock and block-group details, and xfs_repair /dev/vg_data/lv_app checks and repairs an unmounted XFS filesystem; neither changes the size of anything. (Running lvextend with -r would have resized the filesystem in the same step.)

  31. An administrator is documenting how Linux file permissions are read in an 'ls -l' listing that begins with '-rwxr-xr--'. What access does this represent?

    • A.Device file: owner read/write/execute, group read/execute, others read only
    • B.Regular file: owner read/write/execute, group read/execute, others read only
    • C.Regular file: owner read/write/execute, group read only, others read/execute
    • D.Device file: owner read/write/execute, group read only, others read/execute
    Show answerHide answer

    Correct answer: Regular file: owner read/write/execute, group read/execute, others read only

    The first character of '-rwxr-xr--' is a dash, which marks a regular file (a block or character device file would show 'b' or 'c'), and the next nine characters are three triplets in the fixed order owner, group, others: rwx, r-x and r--. That gives 'regular file: owner read/write/execute, group read/execute, others read only'. 'Device file: owner read/write/execute, group read/execute, others read only' misreads the file type; 'regular file: owner read/write/execute, group read only, others read/execute' swaps the group and others triplets; and 'device file: owner read/write/execute, group read only, others read/execute' makes both mistakes.

  32. An administrator must terminate every running process named 'firefox' at once by name rather than looking up each PID. Which command does this directly?

    • A.pgrep -l firefox
    • B.killall firefox
    • C.kill firefox
    • D.kill -9 firefox
    Show answerHide answer

    Correct answer: killall firefox

    killall firefox sends a signal (SIGTERM by default) to every process named firefox, so no PID lookup is needed. pgrep -l firefox only lists the matching PIDs and names without signaling anything; kill firefox fails because kill expects a numeric PID (or job ID), not a process name; and kill -9 firefox fails for the same reason, since -9 changes only the signal sent.

  33. A junior administrator confuses kill and killall. Which statement correctly distinguishes them?

    • A.kill signals all processes with a given name, while killall signals one process by its PID
    • B.kill signals one process by its PID, while killall signals all processes with a given parent
    • C.kill signals one process by its PID, while killall signals all processes with a given name
    • D.kill signals all processes with a given parent, while killall signals one process by its PID
    Show answerHide answer

    Correct answer: kill signals one process by its PID, while killall signals all processes with a given name

    The difference is how the target is chosen: "kill signals one process by its PID, while killall signals all processes with a given name". Both send SIGTERM by default and can send other signals such as SIGKILL with -9. "kill signals all processes with a given name, while killall signals one process by its PID" reverses the two commands. "kill signals one process by its PID, while killall signals all processes with a given parent" confuses killall with pkill -P, which selects processes by their parent PID; killall matches on the command name. "kill signals all processes with a given parent, while killall signals one process by its PID" makes both mistakes.

  34. An administrator wants to launch a backup job at a lower CPU scheduling priority so it does not compete with interactive work. Which command starts it with a reduced priority (higher niceness)?

    • A.nice -n -5 ./backup.sh
    • B.nice -n 10 ./backup.sh
    • C.renice -n 10 ./backup.sh
    • D.renice -n -5 ./backup.sh
    Show answerHide answer

    Correct answer: nice -n 10 ./backup.sh

    nice -n 10 ./backup.sh launches the script with a niceness of +10, a lower CPU scheduling priority, so it yields to interactive work. nice -n -5 ./backup.sh uses a negative value, which raises priority (and needs root), the opposite of the goal. renice -n 10 ./backup.sh fails because renice changes processes that are already running, identified by PID, user or group, and cannot launch a script; renice -n -5 ./backup.sh combines both mistakes.

  35. A long-running process with PID 4821 is hogging the CPU. An administrator wants to lower its priority while it continues running. Which command does this?

    • A.renice -5 -p 4821
    • B.renice +5 -u 4821
    • C.renice -5 -u 4821
    • D.renice +5 -p 4821
    Show answerHide answer

    Correct answer: renice +5 -p 4821

    renice +5 -p 4821 sets the niceness of the running process with PID 4821 to +5, lowering its priority without restarting it. renice -5 -p 4821 uses a negative value, which raises the process's priority instead; renice +5 -u 4821 treats 4821 as a user ID and renices every process owned by that user rather than the one process; and renice -5 -u 4821 makes both mistakes.

  36. On a Debian-based server an administrator must refresh the package index and then upgrade all installed packages to the latest available versions. Which command sequence does this?

    • A.apt upgrade, then apt update
    • B.apt update, then apt upgrade --dry-run
    • C.apt upgrade --dry-run, then apt update
    • D.apt update, then apt upgrade
    Show answerHide answer

    Correct answer: apt update, then apt upgrade

    apt update, then apt upgrade is the right sequence: apt update downloads fresh package lists from the repositories, and apt upgrade then installs the newest available versions of the installed packages. apt upgrade, then apt update runs the upgrade against the stale index and refreshes it only afterwards. apt update, then apt upgrade --dry-run refreshes the index but only simulates the upgrade, installing nothing; apt upgrade --dry-run, then apt update simulates against the stale index and still upgrades nothing.

  37. An administrator is choosing the correct high-level package manager for two servers: one Ubuntu and one Fedora. Which pairing is correct?

    • A.dnf for Ubuntu with .deb packages, apt for Fedora with .rpm packages
    • B.apt for Ubuntu with .rpm packages, dnf for Fedora with .deb packages
    • C.apt for Ubuntu with .deb packages, dnf for Fedora with .rpm packages
    • D.dnf for Ubuntu with .rpm packages, apt for Fedora with .deb packages
    Show answerHide answer

    Correct answer: apt for Ubuntu with .deb packages, dnf for Fedora with .rpm packages

    Ubuntu is Debian-based, so its high-level package manager is apt, working with .deb packages; Fedora is in the Red Hat family, so it uses dnf, working with .rpm packages. That makes "apt for Ubuntu with .deb packages, dnf for Fedora with .rpm packages" correct. "dnf for Ubuntu with .deb packages, apt for Fedora with .rpm packages" swaps the tools; "apt for Ubuntu with .rpm packages, dnf for Fedora with .deb packages" swaps the package formats; and "dnf for Ubuntu with .rpm packages, apt for Fedora with .deb packages" swaps the distributions entirely.

  38. A team compares Linux package managers and wants the accurate mapping of high-level tool to underlying low-level tool and package format. Which mapping is correct?

    • A.apt sits below dpkg for .deb packages; dnf and legacy yum sit below rpm for .rpm packages
    • B.apt sits above rpm for .rpm packages; dnf and legacy yum sit above dpkg for .deb packages
    • C.apt sits above dpkg for .deb packages; dnf and legacy yum sit above rpm for .rpm packages
    • D.apt sits below rpm for .rpm packages; dnf and legacy yum sit below dpkg for .deb packages
    Show answerHide answer

    Correct answer: apt sits above dpkg for .deb packages; dnf and legacy yum sit above rpm for .rpm packages

    apt is the dependency-resolving front end that calls the low-level dpkg tool to install .deb packages, and dnf (like the legacy yum it replaced) is the front end that calls the low-level rpm tool for .rpm packages: "apt sits above dpkg for .deb packages; dnf and legacy yum sit above rpm for .rpm packages". "apt sits below dpkg for .deb packages; dnf and legacy yum sit below rpm for .rpm packages" inverts the layers, putting the low-level tools on top. "apt sits above rpm for .rpm packages; dnf and legacy yum sit above dpkg for .deb packages" swaps the two package families. "apt sits below rpm for .rpm packages; dnf and legacy yum sit below dpkg for .deb packages" makes both mistakes.

  39. An administrator needs to combine three identical disks so that data is striped with parity for fault tolerance, surviving a single disk failure while keeping most capacity usable. Which software RAID level should be created with mdadm?

    • A.RAID 5
    • B.RAID 1
    • C.RAID 6
    • D.RAID 0
    Show answerHide answer

    Correct answer: RAID 5

    RAID 5 stripes data with distributed parity across three or more disks, survives the loss of any one disk and gives up only one disk's worth of capacity to parity (two-thirds usable with three disks). RAID 1 mirrors rather than striping with parity, leaving one disk's worth usable; RAID 6 uses double parity and needs at least four disks, so it does not fit three; and RAID 0 stripes with no parity at all, so a single disk failure loses the array.

  40. An administrator wants the device name in /etc/fstab to remain stable even if disk detection order changes between reboots. Which identifier is the most robust choice for the first field?

    • A.The GRUB device name
    • B.The kernel device name
    • C.The filesystem UUID
    • D.The partition number
    Show answerHide answer

    Correct answer: The filesystem UUID

    The filesystem UUID (written as UUID=... in the first field) is stored in the filesystem itself, so it stays the same whatever order the disks are detected in. The kernel device name such as /dev/sdb1 is assigned in detection order and can change between reboots; the GRUB device name such as (hd0,gpt1) belongs to the boot loader and is not accepted in /etc/fstab at all; and the partition number alone does not say which disk the partition is on.

  41. An administrator must create an XFS filesystem on the new partition /dev/sdc1 before mounting it. Which command does this?

    • A.xfs_growfs /dev/sdc1
    • B.mkfs.xfs /dev/sdc1
    • C.fsck.xfs /dev/sdc1
    • D.xfs_repair /dev/sdc1
    Show answerHide answer

    Correct answer: mkfs.xfs /dev/sdc1

    mkfs.xfs /dev/sdc1 writes a new XFS filesystem onto the partition, after which it can be mounted. xfs_growfs /dev/sdc1 only enlarges an XFS filesystem that already exists and is mounted; fsck.xfs /dev/sdc1 creates nothing (it is a stub that simply exits, because XFS replays its log at mount time); and xfs_repair /dev/sdc1 repairs an existing XFS filesystem rather than creating one.

  42. An administrator wants to add a 4 GiB swap file at /swapfile and activate it immediately. After creating and sizing the file, which sequence enables it as swap?

    • A.swapon /swapfile, then mkswap /swapfile
    • B.mkswap /swapfile, then mount /swapfile
    • C.mkswap /swapfile, then swapon /swapfile
    • D.mount /swapfile, then mkswap /swapfile
    Show answerHide answer

    Correct answer: mkswap /swapfile, then swapon /swapfile

    mkswap /swapfile, then swapon /swapfile is the correct order: mkswap writes the swap signature onto the file, and swapon then activates it for paging straight away. swapon /swapfile, then mkswap /swapfile fails at the first step because the file has no swap signature yet. mkswap /swapfile, then mount /swapfile fails at the second step, because swap is activated with swapon, not mounted like a filesystem; and mount /swapfile, then mkswap /swapfile makes both mistakes.

  43. An administrator needs to change a kernel parameter, net.ipv4.ip_forward, so that it takes effect now and persists across reboots. Which approach accomplishes both?

    • A.Run sysctl -p net.ipv4.ip_forward=1 now and add net.ipv4.ip_forward=1 to a file in /etc/sysctl.d/
    • B.Run sysctl -w net.ipv4.ip_forward=1 now and add net.ipv4.ip_forward=1 to a file in /etc/modprobe.d/
    • C.Run sysctl -p net.ipv4.ip_forward=1 now and add net.ipv4.ip_forward=1 to a file in /etc/modprobe.d/
    • D.Run sysctl -w net.ipv4.ip_forward=1 now and add net.ipv4.ip_forward=1 to a file in /etc/sysctl.d/
    Show answerHide answer

    Correct answer: Run sysctl -w net.ipv4.ip_forward=1 now and add net.ipv4.ip_forward=1 to a file in /etc/sysctl.d/

    sysctl -w writes the new value into the running kernel at once, and a .conf file under /etc/sysctl.d/ is applied at every boot, so "Run sysctl -w net.ipv4.ip_forward=1 now and add net.ipv4.ip_forward=1 to a file in /etc/sysctl.d/" covers both now and after reboots. "Run sysctl -p net.ipv4.ip_forward=1 now and add net.ipv4.ip_forward=1 to a file in /etc/sysctl.d/" fails for the running system: -p loads settings from a file, so sysctl looks for a file with that name and changes nothing until the next boot. "Run sysctl -w net.ipv4.ip_forward=1 now and add net.ipv4.ip_forward=1 to a file in /etc/modprobe.d/" fails at reboot, because /etc/modprobe.d/ holds kernel module options (options, alias, blacklist lines), not sysctl settings. "Run sysctl -p net.ipv4.ip_forward=1 now and add net.ipv4.ip_forward=1 to a file in /etc/modprobe.d/" fails on both counts.

  44. On a systemd-based server an administrator wants to view kernel and service log messages from the current boot only, in real time as new entries arrive. Which command is appropriate?

    • A.journalctl -k -f
    • B.journalctl -b -r
    • C.journalctl -k -r
    • D.journalctl -b -f
    Show answerHide answer

    Correct answer: journalctl -b -f

    journalctl -b -f limits the journal to the current boot and then follows it, printing new kernel and service entries as they arrive. journalctl -k -f follows only kernel messages, so service log messages are left out; journalctl -b -r shows the current boot in reverse order (newest first) and exits instead of following new entries; and journalctl -k -r has both problems.

  45. An administrator must assign the static IP address 192.168.10.50/24 to the interface ens33 right now using the modern iproute2 tooling. Which command does this?

    • A.ip route add 192.168.10.50/24 dev ens33
    • B.ip addr add 192.168.10.50/24 dev ens33
    • C.ip link add 192.168.10.50/24 dev ens33
    • D.ip maddr add 192.168.10.50/24 dev ens33
    Show answerHide answer

    Correct answer: ip addr add 192.168.10.50/24 dev ens33

    ip addr add 192.168.10.50/24 dev ens33 assigns the address and prefix to ens33 immediately, using the iproute2 suite that replaced ifconfig. ip route add 192.168.10.50/24 dev ens33 works on the routing table rather than giving the interface an address (and the kernel rejects this prefix as a route, because its host bits are set); ip link add 192.168.10.50/24 dev ens33 is the subcommand for creating virtual links such as bridges or VLANs, not for addressing; and ip maddr add 192.168.10.50/24 dev ens33 manages multicast link-layer addresses, not the interface's IP address.

  46. An administrator edited /etc/default/grub to change the default timeout and added a kernel argument in a file under /etc/grub.d, but a reboot showed no change. On a RHEL-family system using GRUB2, what step regenerates the active boot configuration from these source files?

    • A.grub2-script-check /boot/grub2/grub.cfg
    • B.grub2-mkconfig -o /boot/grub2/grub.cfg
    • C.grub2-install --boot-directory=/boot /dev/sda
    • D.grub2-set-default --boot-directory=/boot 0
    Show answerHide answer

    Correct answer: grub2-mkconfig -o /boot/grub2/grub.cfg

    grub2-mkconfig -o /boot/grub2/grub.cfg is the step that applies the edits: grub2-mkconfig reads /etc/default/grub and the scripts in /etc/grub.d and writes the grub.cfg that GRUB2 reads at boot, so nothing changes until it is run. grub2-script-check /boot/grub2/grub.cfg only parses an existing grub.cfg for syntax errors and writes nothing, so the old menu stays in place. grub2-install --boot-directory=/boot /dev/sda reinstalls the boot loader code and its modules for that disk, but it does not rebuild grub.cfg from the source files. grub2-set-default --boot-directory=/boot 0 only records which menu entry boots by default in the grubenv file, so the new timeout and kernel argument are still not in grub.cfg.

  47. A server boots straight into a graphical login, but an administrator wants it to come up in a text-only multi-user mode by default on every future boot, using systemd. Which command sets this persistently?

    • A.systemctl set-default multi-user.target
    • B.systemctl stop graphical.target
    • C.systemctl disable graphical.target
    • D.systemctl isolate multi-user.target && reboot
    Show answerHide answer

    Correct answer: systemctl set-default multi-user.target

    systemctl set-default multi-user.target is correct: it repoints the default.target symlink, so every later boot comes up in the text-only multi-user target. systemctl isolate multi-user.target && reboot switches the running system to that target, but isolate changes only the current session, so the reboot brings back the old graphical default. systemctl stop graphical.target stops the graphical target for now only, and the next boot starts it again because it is still the default. systemctl disable graphical.target does not help either: the target has no install section to undo, and disable does not repoint default.target, so the system still boots to the graphical target.

  48. An administrator created a timer unit named backup.timer with an OnCalendar entry and ran 'systemctl enable --now backup.timer', but the backup never runs. Investigation shows no backup.service file exists. Why does the timer fail to trigger any work?

    • A.The timer unit lacks the matching service it activates
    • B.The timer unit needs a daemon-reload before it can start the service
    • C.The timer unit skips the service and runs commands itself
    • D.The timer unit needs Persistent=true to activate the service
    Show answerHide answer

    Correct answer: The timer unit lacks the matching service it activates

    'The timer unit lacks the matching service it activates' is the cause: a .timer does no work itself; when it elapses it activates another unit, by default the .service with the same base name, so backup.timer needs a backup.service (or an explicit Unit= setting) before it has anything to run. 'The timer unit skips the service and runs commands itself' is false, because a timer has no ExecStart= of its own; that line belongs in the service. 'The timer unit needs Persistent=true to activate the service' is false: OnCalendar= works without it, and Persistent=true only makes up runs that were missed while the system was off. 'The timer unit needs a daemon-reload before it can start the service' is not the problem either: systemctl enable already reloads the manager configuration, and no reload can supply a service file that does not exist.

  49. After a package upgrade with 'dnf upgrade' broke an application, an administrator wants to reverse that specific transaction and restore the previous package versions on a RHEL-family system. Which approach does this most directly?

    • A.dnf history redo <ID>
    • B.dnf history undo <ID>
    • C.dnf history rollback <ID>
    • D.dnf history info <ID>
    Show answerHide answer

    Correct answer: dnf history undo <ID>

    dnf history undo <ID> is the direct method: running dnf history lists the transactions so the ID of the bad upgrade can be found, and undo reverses exactly that transaction, putting back the package versions it replaced. dnf history rollback <ID> undoes every transaction made after the given ID while keeping that transaction itself, so pointing it at the upgrade leaves the upgrade in place. dnf history redo <ID> repeats the transaction instead of reversing it. dnf history info <ID> only shows the details of the transaction and changes nothing.

  50. On a Debian-based system an administrator knows a config file lives somewhere on disk and wants to find out which installed package owns that file path. Using only dpkg, which command answers this?

    • A.dpkg -S /etc/logrotate.conf
    • B.dpkg -s /etc/logrotate.conf
    • C.dpkg -L /etc/logrotate.conf
    • D.dpkg -p /etc/logrotate.conf
    Show answerHide answer

    Correct answer: dpkg -S /etc/logrotate.conf

    dpkg -S /etc/logrotate.conf searches the installed-package database for the package that owns a file path, which is exactly the reverse lookup needed (here it reports the logrotate package). dpkg -L /etc/logrotate.conf runs in the opposite direction: -L lists the files that a named package installed, so it expects a package name, not a path. dpkg -s /etc/logrotate.conf is the lowercase status option, which reports the state and details of a named package. dpkg -p /etc/logrotate.conf prints a package's details from the available-packages file, so it also needs a package name rather than a file path.

  51. Before applying risky configuration changes to a mounted ext4 logical volume named lv_db in volume group vg01, an administrator wants a point-in-time copy that can be reverted later. Which command creates an LVM snapshot of that logical volume?

    • A.lvextend -r -L +2G /dev/vg01/lv_db
    • B.dd if=/dev/vg01/lv_db of=/dev/sdb bs=4M status=progress
    • C.lvcreate -s -L 5G -n lv_db_snap /dev/vg01/lv_db
    • D.lvconvert -y --type mirror -m 1 /dev/vg01/lv_db
    Show answerHide answer

    Correct answer: lvcreate -s -L 5G -n lv_db_snap /dev/vg01/lv_db

    lvcreate -s -L 5G -n lv_db_snap /dev/vg01/lv_db creates the snapshot: -s requests a snapshot, -L 5G sizes its copy-on-write area, -n names it, and the origin volume is given last; the snapshot can later be merged back with lvconvert --merge to revert. lvextend -r -L +2G /dev/vg01/lv_db only grows the existing volume and its file system and keeps no earlier copy. lvconvert -y --type mirror -m 1 /dev/vg01/lv_db adds a mirror leg that stays in sync with every write, so it holds the current data, not a point-in-time copy that can be reverted. dd if=/dev/vg01/lv_db of=/dev/sdb bs=4M status=progress makes a raw block copy to another disk, which is not an LVM snapshot and is not consistent while the ext4 file system is mounted and changing.

  52. A newly imaged server reports the wrong time zone and is logging timestamps several hours off. An administrator wants to set the system time zone to America/Chicago using the standard systemd utility. Which command does this?

    • A.hostnamectl set-location America/Chicago
    • B.export TZ=America/Chicago
    • C.zdump America/Chicago
    • D.timedatectl set-timezone America/Chicago
    Show answerHide answer

    Correct answer: timedatectl set-timezone America/Chicago

    timedatectl set-timezone America/Chicago is the systemd way: timedatectl manages the system clock settings, and set-timezone repoints /etc/localtime at the America/Chicago zone file, so new log timestamps use the right offset. hostnamectl set-location America/Chicago only stores a free-text location string with the host's metadata and has no effect on time. export TZ=America/Chicago changes the zone for the current shell and the programs it starts, not for the system or its services. zdump America/Chicago only prints the current time as it would read in that zone and changes no setting.

  53. An administrator notices a process shown in 'ps' output with a state code of Z and a parent that is still running. What does this indicate and what is the appropriate remediation?

    • A.It is a stopped job; have its parent wake it by sending SIGCONT
    • B.It is a zombie; have its parent end it by sending SIGKILL
    • C.It is a zombie; have its parent reap it by calling wait
    • D.It is a stopped job; have its parent resume it by running bg
    Show answerHide answer

    Correct answer: It is a zombie; have its parent reap it by calling wait

    'It is a zombie; have its parent reap it by calling wait' is right: state Z marks a defunct process that has already exited but keeps its process-table entry until the parent collects its exit status with wait(), so the remedy is to fix or signal the parent (if the parent dies, systemd adopts the entry and reaps it). 'It is a zombie; have its parent end it by sending SIGKILL' fails because a zombie is already dead and cannot be killed again, by its parent or by anyone else; only reaping removes the entry. 'It is a stopped job; have its parent wake it by sending SIGCONT' and 'It is a stopped job; have its parent resume it by running bg' both misread the code: a stopped process shows state T, not Z, so continuing it does not apply here.

Services and User Management (38)

  1. In Linux, what is the primary function of the 'systemd' system and service manager?

    • A.To monitor and record system activity
    • B.To start and supervise system daemons
    • C.To install and update system packages
    • D.To partition and format system drives
    Show answerHide answer

    Correct answer: To start and supervise system daemons

    systemd runs as PID 1, and its main job is 'To start and supervise system daemons': it brings services up at boot from unit files and starts, stops and restarts them afterward, replacing the old init scripts. 'To monitor and record system activity' is the job of tools such as sar, 'To install and update system packages' belongs to a package manager such as apt or dnf, and 'To partition and format system drives' is done with tools such as fdisk and mkfs.

  2. In Linux, what is the purpose of the 'useradd' command?

    • A.To add a new group account
    • B.To expire an existing account
    • C.To add a new user account
    • D.To delete an existing account
    Show answerHide answer

    Correct answer: To add a new user account

    useradd is used 'To add a new user account': it writes the entries in /etc/passwd and /etc/shadow and, with -m, creates the home directory. 'To add a new group account' describes groupadd, 'To expire an existing account' is done with chage -E or usermod -e, and 'To delete an existing account' describes userdel.

  3. What is the primary use of the 'usermod' command in Linux?

    • A.To display the details of a user account
    • B.To create the records of a user account
    • C.To delete the records of a user account
    • D.To change the settings of a user account
    Show answerHide answer

    Correct answer: To change the settings of a user account

    usermod is used 'To change the settings of a user account' that already exists: its login name (-l), home directory (-d), shell (-s), supplementary groups (-aG) or expiry date (-e). 'To create the records of a user account' describes useradd, which writes a new account into /etc/passwd and /etc/shadow rather than changing an existing one, 'To display the details of a user account' describes id or getent passwd, and 'To delete the records of a user account' describes userdel.

  4. Which Linux command is used to set or view user quotas for disk space usage?

    • A.du
    • B.df
    • C.mount
    • D.quota
    Show answerHide answer

    Correct answer: quota

    quota reports a user's disk usage and limits on filesystems that have quotas enabled (for example quota -u alice); the limits themselves are set with its companion tools edquota and setquota. du only totals the space that files and directories occupy, with no per-user limits; df reports free space per filesystem, not per-user limits; mount attaches filesystems, and its usrquota option merely makes quota accounting possible.

  5. In Linux, which command is used to display the status of a particular service or a list of all running services?

    • A.htop
    • B.loginctl
    • C.systemctl
    • D.localectl
    Show answerHide answer

    Correct answer: systemctl

    'systemctl status nginx' shows whether a unit is active, its main PID and recent log lines, and 'systemctl list-units --type=service --state=running' lists every running service, so systemctl is the command. 'htop' lists processes rather than services, 'loginctl' lists and manages user login sessions, and 'localectl' shows and sets the system locale and keyboard layout.

  6. An administrator writes a provisioning script that must run identically across Debian, RHEL, and Alpine systems without prompting for input. Which user-creation utility should the script call to ensure consistent, non-interactive behavior on every distribution?

    • A.useradd, because it is a low-level tool shipped almost everywhere
    • B.chpasswd, because it is a batch tool driven from standard input
    • C.adduser, because it is a friendly front end with sensible defaults
    • D.systemd-sysusers, because it is a front end driven by config files
    Show answerHide answer

    Correct answer: useradd, because it is a low-level tool shipped almost everywhere

    'useradd, because it is a low-level tool shipped almost everywhere' is right: useradd is the low-level shadow-utils binary, it takes every setting as a command-line option and never prompts, so one script line behaves the same on each system (on Alpine it comes from the shadow package). 'adduser, because it is a friendly front end with sensible defaults' fails the consistency test: on Debian and Ubuntu adduser is an interactive wrapper that prompts, on RHEL it is only a link to useradd, and on Alpine it is a BusyBox applet with different options. 'chpasswd, because it is a batch tool driven from standard input' only sets passwords for accounts that already exist and cannot create one. 'systemd-sysusers, because it is a front end driven by config files' creates system accounts from sysusers.d files and depends on systemd, which Alpine does not use.

  7. A help-desk technician is told to create a standard user named jbauer on a RHEL server, including a home directory and a default shell of /bin/bash, in a single non-interactive command. Which command accomplishes this?

    • A.usermod -m -s /bin/bash jbauer
    • B.useradd -r -s /bin/bash jbauer
    • C.useradd -m -s /bin/bash jbauer
    • D.usermod -r -s /bin/bash jbauer
    Show answerHide answer

    Correct answer: useradd -m -s /bin/bash jbauer

    useradd -m -s /bin/bash jbauer is correct: useradd creates the new account, -m makes it create the home directory whatever the CREATE_HOME default says, and -s sets /bin/bash as the login shell. useradd -r -s /bin/bash jbauer creates a system account instead, with a UID from the system range and no home directory unless -m is added. usermod -m -s /bin/bash jbauer edits an account that must already exist, and its -m option means move the home directory and works only together with -d. usermod -r -s /bin/bash jbauer cannot create jbauer either, and its -r option removes a user from the groups listed with -G.

  8. After running useradd to create a new account, an administrator notices the user cannot log in even though the account exists in /etc/passwd. What is the most likely cause?

    • A.No wheel membership has been granted, so the login is refused
    • B.No shadow entry has been made, so the login check fails
    • C.No shell has been set, so the session cannot start
    • D.No password has been set, so the shadow entry is locked
    Show answerHide answer

    Correct answer: No password has been set, so the shadow entry is locked

    'No password has been set, so the shadow entry is locked' is the likely cause: useradd does not assign a password, so the account's password field in /etc/shadow holds ! or !! and password logins fail until the administrator runs passwd for the user. 'No wheel membership has been granted, so the login is refused' confuses logging in with privilege, because the wheel group only governs who may use sudo or su. 'No shadow entry has been made, so the login check fails' is false, since useradd writes the /etc/shadow line at the same time as the /etc/passwd line. 'No shell has been set, so the session cannot start' is also wrong: useradd fills in the default login shell, and even an empty shell field falls back to /bin/sh.

  9. A security auditor asks where encrypted user password hashes and password-aging fields are stored on a modern Linux system. Which file holds this information?

    • A./etc/group
    • B./etc/passwd
    • C./etc/shadow
    • D./etc/gshadow
    Show answerHide answer

    Correct answer: /etc/shadow

    /etc/shadow is correct: it holds each account's password hash together with the aging fields (date of last change, minimum and maximum age, warning period, inactivity and expiry), and only root can read it. /etc/passwd is world-readable, so modern systems leave just an x placeholder in its password field. /etc/group lists groups and their members, and /etc/gshadow holds group passwords and group administrators, not user password hashes.

  10. A junior admin opens /etc/passwd and sees the line: deploy:x:1005:1005:Deploy User:/home/deploy:/bin/bash. What does the x in the second field indicate?

    • A.The hash itself is kept in the protected shadow file
    • B.The account password is expired and must be reset at login
    • C.The hash is stored with the group entries in gshadow
    • D.The account is locked and waits for an admin to unlock it
    Show answerHide answer

    Correct answer: The hash itself is kept in the protected shadow file

    'The hash itself is kept in the protected shadow file' is right: the x is a placeholder telling the system that the real password hash sits in /etc/shadow, which only root can read, rather than in the world-readable /etc/passwd. 'The account is locked and waits for an admin to unlock it' is wrong, because a lock shows up as ! or * at the start of the hash in /etc/shadow, not as an x here. 'The account password is expired and must be reset at login' is wrong too, since expiry is tracked in the aging fields of /etc/shadow. 'The hash is stored with the group entries in gshadow' mixes up the files: /etc/gshadow holds group passwords, not user password hashes.

  11. An administrator needs to add the existing user sarah to the secondary group developers without removing her from any of her current groups. Which command does this correctly?

    • A.usermod -G developers sarah
    • B.usermod -aG developers sarah
    • C.usermod -aG sarah developers
    • D.usermod -G sarah developers
    Show answerHide answer

    Correct answer: usermod -aG developers sarah

    usermod -aG developers sarah is correct: -G names the supplementary group to set and -a appends it, so sarah joins developers and keeps every group she already has. usermod -G developers sarah drops the -a, so her supplementary list is replaced by developers alone and she loses her other groups. usermod -aG sarah developers reverses the arguments: usermod expects the group list first and the login name last, so it looks for a group named sarah and a user named developers and fails. usermod -G sarah developers combines both mistakes.

  12. An administrator wants to add the user mike to the docker group, but only the -a/-G usermod approach feels error-prone. Which dedicated command adds a single user to a group as a focused operation?

    • A.chgrp docker /home/mike
    • B.gpasswd -A mike docker
    • C.chown docker /home/mike
    • D.gpasswd -a mike docker
    Show answerHide answer

    Correct answer: gpasswd -a mike docker

    gpasswd -a mike docker is correct: gpasswd is the dedicated tool for administering /etc/group and /etc/gshadow, and -a adds one user to one group without touching the user's other memberships. gpasswd -A mike docker uses the uppercase option, which sets the group's administrators, so mike could manage docker but would not become a member. chgrp docker /home/mike changes the group that owns a file or directory, not the members of a group. chown docker /home/mike likewise changes file ownership, here making a user named docker the owner, and leaves the docker group's member list unchanged.

  13. A new administrator asks when to use sudo versus su for routine administrative tasks on a multi-admin server. Which statement best describes the recommended distinction?

    • A.sudo runs permitted commands with your own password and logs them; su gives a full shell with the target's password
    • B.sudo runs permitted commands with the target's password and logs them; su gives a full shell with your own password
    • C.su runs permitted commands with the target's password and logs them; sudo gives a full shell with your own password
    • D.su runs permitted commands with your own password and logs them; sudo gives a full shell with the target's password
    Show answerHide answer

    Correct answer: sudo runs permitted commands with your own password and logs them; su gives a full shell with the target's password

    'sudo runs permitted commands with your own password and logs them; su gives a full shell with the target's password' is the recommended distinction: sudo checks /etc/sudoers, asks for the invoking user's own password, runs only the commands that policy allows and records each one, while su starts a shell as another user (usually root) once that user's password is entered. 'su runs permitted commands with your own password and logs them; sudo gives a full shell with the target's password' swaps the two tools. 'sudo runs permitted commands with the target's password and logs them; su gives a full shell with your own password' swaps whose password each tool asks for. 'su runs permitted commands with the target's password and logs them; sudo gives a full shell with your own password' makes su the per-command, logged tool, which it is not: su has no command policy and keeps no per-command log.

  14. On a hardened server the root account password is locked and direct root login is disabled, yet administrators must still perform privileged tasks. Which approach is consistent with this configuration?

    • A.Use su with the superuser's password
    • B.Use ssh root@localhost with the superuser's password
    • C.Use sudo with each admin's own password
    • D.Use runuser -u root with each admin's own password
    Show answerHide answer

    Correct answer: Use sudo with each admin's own password

    'Use sudo with each admin's own password' fits the configuration: sudo authenticates the invoking user with that user's own password and checks /etc/sudoers for the commands that user may run, so it works while the root password is locked and keeps a per-admin audit trail. 'Use su with the superuser's password' cannot work, because su needs the root password and that password is locked. 'Use ssh root@localhost with the superuser's password' is a direct root login, which this server disables, and it would also need the locked password. 'Use runuser -u root with each admin's own password' fails because runuser asks for no password at all; only root may run it, so it gives an ordinary admin no way in.

  15. An administrator must grant the user ops permission to run only /usr/bin/systemctl restart nginx as root, without a password prompt, and nothing else. Which /etc/sudoers entry is correct?

    • A.%wheel ALL=(root) NOPASSWD: /usr/bin/systemctl restart nginx
    • B.ops ALL=(root) /usr/bin/systemctl restart nginx
    • C.ops ALL=(root) NOPASSWD: /usr/bin/systemctl restart nginx
    • D.%wheel ALL=(root) /usr/bin/systemctl restart nginx
    Show answerHide answer

    Correct answer: ops ALL=(root) NOPASSWD: /usr/bin/systemctl restart nginx

    ops ALL=(root) NOPASSWD: /usr/bin/systemctl restart nginx is correct: it names the user ops, lets that user run exactly /usr/bin/systemctl restart nginx as root on any host, and the NOPASSWD: tag removes the password prompt. ops ALL=(root) /usr/bin/systemctl restart nginx limits the command correctly but leaves out NOPASSWD:, so sudo still asks for a password. %wheel ALL=(root) NOPASSWD: /usr/bin/systemctl restart nginx grants the rule to every member of the wheel group instead of to the user ops, who may not even be a member. %wheel ALL=(root) /usr/bin/systemctl restart nginx has both faults: the wrong principal and a password prompt.

  16. An administrator wants public-key SSH authentication to a server. They run ssh-keygen and then must install the public half on the server. Which file on the server stores the user's authorized public keys?

    • A.~/.ssh/authorized_keys
    • B./etc/ssh/ssh_known_hosts
    • C.~/.ssh/authorized_principals
    • D./etc/ssh/sshd_config
    Show answerHide answer

    Correct answer: ~/.ssh/authorized_keys

    ~/.ssh/authorized_keys is correct: sshd checks each public key a client offers against the entries, one per line, in that user's authorized_keys file on the server. ~/.ssh/authorized_principals is a different list: when sshd is set up for certificate logins it names the principals a certificate may carry, not the public keys a user may log in with. /etc/ssh/sshd_config is the daemon's configuration file, where the AuthorizedKeysFile setting names that per-user file, but it stores no keys itself. /etc/ssh/ssh_known_hosts is the system-wide list of host keys that clients use to recognize servers, so it holds no keys allowed to log in.

  17. A developer is asked to explain the roles of the SSH key pair. Which statement correctly describes the relationship between the public and private keys?

    • A.The public key is placed on servers, while the private key is sent along at each login
    • B.The private key is placed on servers, while the public key stays secret on the client
    • C.The private key is placed on servers, while the public key is sent along at each login
    • D.The public key is placed on servers, while the private key stays secret on the client
    Show answerHide answer

    Correct answer: The public key is placed on servers, while the private key stays secret on the client

    'The public key is placed on servers, while the private key stays secret on the client' describes the pair correctly: the public half can be copied to any server's authorized_keys, and the private half never leaves the client, which proves it holds that key by signing the server's challenge. 'The private key is placed on servers, while the public key stays secret on the client' reverses the roles. 'The public key is placed on servers, while the private key is sent along at each login' is wrong because the private key is never transmitted; only a signature made with it is sent. 'The private key is placed on servers, while the public key is sent along at each login' puts the secret half on the server, which would defeat the scheme.

  18. An administrator on a Linux workstation needs to generate a modern, secure SSH key pair using the Ed25519 algorithm. Which command does this?

    • A.ssh-keyscan -t ed25519 -H server
    • B.ssh-keygen -t ed25519 -C admin@host
    • C.ssh-copy-id -i ~/.ssh/id_ed25519 admin@server
    • D.ssh-keygen -y -f ~/.ssh/id_ed25519
    Show answerHide answer

    Correct answer: ssh-keygen -t ed25519 -C admin@host

    ssh-keygen -t ed25519 -C admin@host is correct: ssh-keygen creates key pairs, -t ed25519 selects the Ed25519 elliptic-curve type, and -C admin@host stores a comment label in the public key. ssh-keygen -y -f ~/.ssh/id_ed25519 only reads an existing private key and prints its public half, so it creates nothing new. ssh-keyscan -t ed25519 -H server fetches a server's Ed25519 host key over the network and prints it with the host name hashed, which is how known_hosts entries are gathered, not how a user key pair is made. ssh-copy-id -i ~/.ssh/id_ed25519 admin@server copies the public key of a key pair that already exists to a remote account.

  19. After generating an SSH key pair, an administrator wants to copy the public key to a remote host so password-less login works. Which command is the simplest correct method?

    • A.ssh -o ForwardAgent=yes user@host
    • B.rsync *.pub user@host
    • C.ssh-copy-id user@host
    • D.scp ~/.ssh/id_ecdsa.pub user@host:
    Show answerHide answer

    Correct answer: ssh-copy-id user@host

    ssh-copy-id user@host is the simplest correct method: it logs in once with the password, appends the local public key to ~/.ssh/authorized_keys on the remote account and fixes the permissions on ~/.ssh. scp ~/.ssh/id_ecdsa.pub user@host: only drops the .pub file into the remote home directory, where sshd never looks for keys. ssh -o ForwardAgent=yes user@host only forwards the local SSH agent for onward connections from that session; it installs nothing, so the server still asks for a password. rsync *.pub user@host has no colon after the host, so rsync treats user@host as a local destination and copies the files on the local machine.

  20. An administrator must permanently start the nginx service now and ensure it also launches automatically at every boot. Which command sequence accomplishes both goals?

    • A.systemctl start nginx then systemctl unmask nginx
    • B.systemctl start nginx then systemctl enable nginx
    • C.systemctl start nginx then systemctl reload nginx
    • D.systemctl start nginx then systemctl is-enabled nginx
    Show answerHide answer

    Correct answer: systemctl start nginx then systemctl enable nginx

    systemctl start nginx then systemctl enable nginx meets both goals: start launches the service now, and enable creates the symlinks that start it at every boot (systemctl enable --now nginx does both in one step). systemctl start nginx then systemctl reload nginx starts it now, but reload only makes the running service reread its configuration and sets up nothing for boot. systemctl start nginx then systemctl unmask nginx also starts it, but unmask only removes a mask and does not enable the unit for boot. systemctl start nginx then systemctl is-enabled nginx starts it as well, yet is-enabled only reports the boot setting and changes nothing.

  21. A service named appd fails to start, and the administrator needs to see its current status, recent log lines, and whether it is enabled at boot in one command. Which command provides this?

    • A.journalctl -u appd -b
    • B.systemctl status appd
    • C.systemctl is-enabled appd
    • D.journalctl -xeu appd
    Show answerHide answer

    Correct answer: systemctl status appd

    systemctl status appd is correct: in one output it shows whether the unit is active or failed, whether it is enabled at boot (on the Loaded: line), its main PID and the most recent journal lines for the service. systemctl is-enabled appd prints only the boot setting. journalctl -u appd -b shows the service's log entries since the current boot but not its state or boot setting, and journalctl -xeu appd jumps to the end of the same log with extra explanations, again without the enabled status.

  22. After editing /etc/systemd/system/myapp.service, an administrator restarts the service but the changes are ignored. What step was missed?

    • A.Run systemctl cat myapp so systemd shows the unit file
    • B.Run systemctl reload myapp so systemd rereads its settings
    • C.Run systemctl reset-failed so systemd clears its error state
    • D.Run systemctl daemon-reload so systemd rereads unit files
    Show answerHide answer

    Correct answer: Run systemctl daemon-reload so systemd rereads unit files

    'Run systemctl daemon-reload so systemd rereads unit files' is the missed step: systemd keeps a parsed copy of every unit in memory, so after myapp.service is edited it must be told to reload the definitions from disk, and until then each restart reuses the old one. 'Run systemctl reload myapp so systemd rereads its settings' confuses the two kinds of reload: reload asks the running service to reread its own configuration through ExecReload=, while systemd keeps using the cached unit file. 'Run systemctl cat myapp so systemd shows the unit file' only prints the file as it is on disk (it may warn that the loaded copy is out of date) and loads nothing. 'Run systemctl reset-failed so systemd clears its error state' only clears the failed status that units are holding and rereads nothing.

  23. An administrator wants to inspect the systemd journal for only the sshd service since the last boot, showing the newest entries. Which command does this?

    • A.journalctl -p err -b
    • B.journalctl -u sshd --since today
    • C.journalctl -p err --since today
    • D.journalctl -u sshd -b
    Show answerHide answer

    Correct answer: journalctl -u sshd -b

    journalctl -u sshd -b is correct: -u limits the output to the sshd unit and -b to entries from the current boot, so it lists sshd's messages since the system last started, ending with the newest. journalctl -p err -b keeps the boot limit but filters by priority instead of by unit, so it shows error-level messages from every service rather than only sshd's. journalctl -u sshd --since today keeps the unit filter but starts at midnight rather than at the boot, so it can include entries from before the boot or leave out older entries from the same boot. journalctl -p err --since today makes both mistakes.

  24. On an RHEL 9 host, an administrator must install the package httpd and automatically resolve its dependencies. Which command is appropriate?

    • A.dnf reinstall httpd
    • B.dnf install httpd
    • C.rpm -U httpd
    • D.rpm -i httpd
    Show answerHide answer

    Correct answer: dnf install httpd

    dnf install httpd is correct: dnf is the RHEL 9 package manager, and install fetches httpd from the enabled repositories, works out every dependency and installs them all in one transaction. dnf reinstall httpd only reinstalls a package that is already present, so on a host without httpd it reports that the package is not installed and changes nothing. rpm -i httpd expects a local .rpm file and does not resolve dependencies from the repositories. rpm -U httpd has the same limit: it upgrades or installs from a local .rpm file and does not fetch dependencies from the repositories either.

  25. An administrator must change the primary group of the user webadmin to the existing group www-data. Which command does this correctly?

    • A.usermod -G www-data webadmin
    • B.useradd -g www-data webadmin
    • C.usermod -g www-data webadmin
    • D.useradd -G www-data webadmin
    Show answerHide answer

    Correct answer: usermod -g www-data webadmin

    usermod -g www-data webadmin is correct: usermod changes an existing account, and the lowercase -g sets its primary (login) group, the group ID stored in /etc/passwd. usermod -G www-data webadmin uses the uppercase option, which sets the supplementary group list instead, so the primary group stays the same and any other supplementary groups are dropped. useradd -g www-data webadmin is the account-creation command, so it stops with an error because webadmin already exists. useradd -G www-data webadmin repeats that error with the supplementary-group option.

  26. An administrator needs to lock the account of a departing employee named contractor so it can no longer authenticate by password, without deleting the account or its files. Which command is appropriate?

    • A.passwd -e contractor
    • B.usermod -U contractor
    • C.passwd -x 0 contractor
    • D.usermod -L contractor
    Show answerHide answer

    Correct answer: usermod -L contractor

    usermod -L contractor is correct: -L puts an exclamation mark in front of the password hash in /etc/shadow, so password logins fail while the account, its home directory and its files stay in place. usermod -U contractor does the opposite: it removes that mark and unlocks the password. passwd -e contractor only marks the password as expired, so the user can still sign in with it and is then asked to choose a new one. passwd -x 0 contractor sets the maximum password age to zero, which has the same effect: the old password still works for that sign-in, followed by a forced change.

  27. A scheduled report must run as the user analytics every weekday at 6:00 AM. Which crontab entry placed in that user's crontab is correct?

    • A.0 6 1-5 * * /opt/scripts/report.sh
    • B.6 0 1-5 * * /opt/scripts/report.sh
    • C.6 0 * * 1-5 /opt/scripts/report.sh
    • D.0 6 * * 1-5 /opt/scripts/report.sh
    Show answerHide answer

    Correct answer: 0 6 * * 1-5 /opt/scripts/report.sh

    0 6 * * 1-5 /opt/scripts/report.sh is correct: the five time fields are minute, hour, day of month, month and day of week, so 0 6 means 6:00 AM and 1-5 in the last field means Monday through Friday. 6 0 * * 1-5 /opt/scripts/report.sh swaps the minute and hour fields, so it runs at 12:06 AM instead. 6 0 1-5 * * /opt/scripts/report.sh makes both mistakes at once: it runs at 12:06 AM, and only on the first five days of each month. 0 6 1-5 * * /opt/scripts/report.sh puts 1-5 in the day-of-month field, so the job runs on the first five days of every month whatever the weekday.

  28. An administrator wants a maintenance task to run once daily but does not care about the exact time and wants it to run even if the machine was powered off at the scheduled moment. Which facility is most appropriate?

    • A.anacron via /etc/cron.daily
    • B.atd via a daily batch job
    • C.crond via a daily job in /etc/cron.d
    • D.crond via an @daily crontab entry
    Show answerHide answer

    Correct answer: anacron via /etc/cron.daily

    'anacron via /etc/cron.daily' is the right facility: anacron records when each daily, weekly and monthly job last ran and, once the machine is powered on, runs any job that is overdue after a short delay, so no exact time is needed and a run missed while the system was off is made up. 'crond via a daily job in /etc/cron.d' runs at the time written in the entry and simply skips a run that falls while the machine is off. 'crond via an @daily crontab entry' is cron shorthand for midnight each day, so it is skipped in the same way whenever the machine is off at midnight. 'atd via a daily batch job' cannot repeat at all: atd runs a batch job once, when the system load allows.

  29. A user needs to temporarily switch their effective group to render in the current shell session so that newly created files inherit that group ownership, without logging out. Which command does this?

    • A.gpasswd -a $USER render
    • B.sg render -c id
    • C.newgrp render
    • D.usermod -g render $USER
    Show answerHide answer

    Correct answer: newgrp render

    newgrp render is correct: it starts a new shell in the same terminal with render as the active group, so files created from that shell get render as their group, and typing exit returns to the original group. usermod -g render $USER changes the account's primary group permanently in /etc/passwd, needs root, and does not affect the shell that is already running. gpasswd -a $USER render adds the user to the render group, but the running session keeps its old group list until a new login or a newgrp. sg render -c id runs only the id command with render as its group and then returns, so the shell's own group never changes.

  30. An administrator is configuring a container service and chooses Podman over Docker on a RHEL host because of a specific architectural advantage tested on the exam. What is that advantage?

    • A.Podman is distributed and balances a pool of containers across hosts
    • B.Podman is daemonless and lets a non-root user run rootless containers
    • C.Podman is daemonized and routes each container through a root service
    • D.Podman is virtualized and runs each container inside a virtual machine
    Show answerHide answer

    Correct answer: Podman is daemonless and lets a non-root user run rootless containers

    'Podman is daemonless and lets a non-root user run rootless containers' is the advantage: each podman command starts its containers directly as child processes, with no long-running root-owned service in between, and user namespaces let an unprivileged account run its own containers, which shrinks the attack surface. 'Podman is daemonized and routes each container through a root service' describes Docker's dockerd design, the very thing Podman avoids. 'Podman is distributed and balances a pool of containers across hosts' is the job of an orchestrator such as Kubernetes; Podman manages containers and pods on a single host. 'Podman is virtualized and runs each container inside a virtual machine' is wrong as well: on a Linux host Podman runs containers as isolated processes that share the host kernel, and it uses a virtual machine only to supply a Linux kernel on macOS or Windows.

  31. An administrator wants to run an nginx container in the background, mapping host port 8080 to container port 80, using Docker. Which command is correct?

    • A.docker run -d -p 80:8080 nginx
    • B.docker create -p 8080:80 nginx
    • C.docker create -p 80:8080 nginx
    • D.docker run -d -p 8080:80 nginx
    Show answerHide answer

    Correct answer: docker run -d -p 8080:80 nginx

    docker run -d -p 8080:80 nginx is correct: run creates and starts the container, -d detaches it so it keeps running in the background, and -p 8080:80 publishes host port 8080 to port 80 inside the container (host first, container second). docker run -d -p 80:8080 nginx reverses the mapping, sending host port 80 to container port 8080, where nginx is not listening. docker create -p 8080:80 nginx sets up the container with the right mapping but never starts it, so nothing runs until docker start is used. docker create -p 80:8080 nginx makes both mistakes.

  32. An administrator must view the standard output logs of a running container named webapp managed by Podman. Which command shows those logs?

    • A.podman pod logs webapp
    • B.podman logs webapp
    • C.podman container stats webapp
    • D.podman container inspect webapp
    Show answerHide answer

    Correct answer: podman logs webapp

    podman logs webapp is correct: it prints the stdout and stderr output that the container named webapp has produced, and adding -f follows it live. podman pod logs webapp reads the logs of a pod, so it fails here because webapp is a standalone container, not a pod. podman container inspect webapp returns the container's configuration and state as JSON rather than its output, and podman container stats webapp shows live CPU, memory and I/O usage figures.

  33. An administrator notices a runaway process owned by the user batch consuming excessive CPU and needs to lower its scheduling priority while it continues to run. Which command adjusts the priority of the already-running process with PID 4096?

    • A.renice -n 10 -p 4096
    • B.nice -n 10 4096
    • C.nice -n -10 4096
    • D.renice -n -10 -p 4096
    Show answerHide answer

    Correct answer: renice -n 10 -p 4096

    renice -n 10 -p 4096 is correct: renice changes the niceness of a process that is already running, -p names it by PID, and -n 10 raises its nice value, which lowers its scheduling priority while it keeps running. renice -n -10 -p 4096 moves the wrong way: a negative value lowers the nice value and so raises the process's priority, which only root may do. nice -n 10 4096 sets a priority only for a new command that it launches, so it would try to run a program called 4096 instead of changing the existing process. nice -n -10 4096 makes both mistakes.

  34. A daemon must be reloaded so it re-reads its configuration file without dropping current client connections. Which systemctl subcommand is designed for this?

    • A.systemctl restart sshd
    • B.systemctl try-restart sshd
    • C.systemctl reload sshd
    • D.systemctl reenable sshd
    Show answerHide answer

    Correct answer: systemctl reload sshd

    systemctl reload sshd is correct: reload tells the running daemon to re-read its configuration in place (usually by sending it SIGHUP), so existing client connections stay up. systemctl restart sshd stops the daemon completely and starts a new one, which for most services drops connected clients; systemctl try-restart sshd performs the same full stop and start, only skipping units that are not already running; and systemctl reenable sshd just disables and re-enables the unit's boot symlinks without touching the running configuration.

  35. An administrator needs to verify which secondary groups the user devops currently belongs to. Which command displays the user's group memberships?

    • A.getent passwd devops
    • B.groups devops
    • C.getent group devops
    • D.id -g devops
    Show answerHide answer

    Correct answer: groups devops

    groups devops is correct because it prints every group the user devops belongs to, both the primary group and the supplementary ones. getent group devops prints the group-database entry for a group that happens to be named devops, listing that group's members rather than the user's memberships; getent passwd devops prints the user's passwd line, which holds only the numeric primary GID; and id -g devops prints just the primary group's numeric ID, so neither of these shows the secondary groups (plain id devops would).

  36. An administrator must completely remove the user tempworker along with that user's home directory and mail spool in a single command. Which command does this?

    • A.passwd -l tempworker
    • B.userdel -r tempworker
    • C.userdel tempworker
    • D.passwd --delete tempworker
    Show answerHide answer

    Correct answer: userdel -r tempworker

    userdel -r tempworker is correct: the -r option deletes the account and also removes the user's home directory and mail spool in the same step. userdel tempworker without -r deletes only the account entries and leaves the home directory and mail spool behind; passwd -l tempworker only locks the password so it can no longer be used to log in; and passwd --delete tempworker only empties the password field, leaving the account and all of its files in place.

  37. An administrator wants to set password aging on the account jwilson so the password expires (must be changed) every 90 days. Which command sets the maximum password age?

    • A.chage -m 90 jwilson
    • B.chage -M 90 jwilson
    • C.chage -W 90 jwilson
    • D.chage -d 90 jwilson
    Show answerHide answer

    Correct answer: chage -M 90 jwilson

    chage -M 90 jwilson is correct: the uppercase -M option of chage sets the maximum number of days a password stays valid, so jwilson must change it every 90 days. chage -m 90 jwilson, with a lowercase -m, sets the minimum number of days between changes, which blocks early changes rather than forcing one; chage -W 90 jwilson only sets how many days of warning the user gets before the password expires; and chage -d 90 jwilson sets the date of the last password change (90 days after January 1, 1970) rather than how long a password stays valid.

  38. On a systemd host an administrator wants to prevent the bluetooth service from ever being started, even as a dependency of another unit. Which command enforces this?

    • A.systemctl disable bluetooth
    • B.systemctl mask bluetooth
    • C.systemctl isolate bluetooth
    • D.systemctl kill bluetooth
    Show answerHide answer

    Correct answer: systemctl mask bluetooth

    systemctl mask bluetooth is correct: masking links the unit file to /dev/null, so the service cannot be started by hand or pulled in as a dependency of another unit. systemctl disable bluetooth only removes the symlinks that start it at boot, so a dependency or a manual start can still launch it; systemctl kill bluetooth just sends a signal to the processes that are running now; and systemctl isolate bluetooth tries to start the unit and stop everything it does not need, which is meant for targets and is refused here because the bare name is read as bluetooth.target, which does not set AllowIsolate.

Security (40)

  1. In Linux, what is the purpose of the 'chroot' command?

    • A.To change the home directory of a user
    • B.To change the root directory of a process
    • C.To change the current directory of a shell
    • D.To change the access rights of a directory
    Show answerHide answer

    Correct answer: To change the root directory of a process

    chroot starts a process (and its children) with a different apparent root, so 'To change the root directory of a process' is right: the chosen directory becomes / for that process, which is used for repairs and sandboxed testing. 'To change the current directory of a shell' describes cd, 'To change the home directory of a user' describes usermod -d, and 'To change the access rights of a directory' describes chmod.

  2. In Linux, what is the effect of setting the sticky bit on a directory?

    • A.New files in the directory inherit its group owner
    • B.Non-admins cannot write files in the directory
    • C.New files in the directory inherit its access mode
    • D.Non-owners cannot delete files in the directory
    Show answerHide answer

    Correct answer: Non-owners cannot delete files in the directory

    With the sticky bit set (mode 1777, as on /tmp), a file can be deleted or renamed only by its owner, the directory's owner or root, so 'Non-owners cannot delete files in the directory'. 'New files in the directory inherit its group owner' is the effect of the setgid bit on a directory. 'Non-admins cannot write files in the directory' would need write access removed, which the sticky bit does not do, and 'New files in the directory inherit its access mode' matches no special bit, since new files take their mode from the umask or a default ACL.

  3. What is the primary function of the 'iptables' command in Linux?

    • A.Configuring and removing static routes
    • B.Capturing and analyzing network packets
    • C.Creating and maintaining firewall rules
    • D.Adding and deleting interface addresses
    Show answerHide answer

    Correct answer: Creating and maintaining firewall rules

    iptables is the user-space tool for 'Creating and maintaining firewall rules': it adds, lists and deletes the packet-filter rules in the kernel's netfilter tables. 'Configuring and removing static routes' is done with ip route (or the older route), 'Capturing and analyzing network packets' is the job of tcpdump, and 'Adding and deleting interface addresses' is done with ip addr.

  4. Which Linux command is used to assign an owner to a file?

    • A.chmod
    • B.chage
    • C.chcon
    • D.chown
    Show answerHide answer

    Correct answer: chown

    'chown' sets the user (and optionally the group) that owns a file, for example chown alice report.txt. 'chmod' changes a file's permission mode, not its owner. 'chage' changes password-aging settings for a user account, and 'chcon' changes a file's SELinux security context.

  5. What is the primary use of the 'iptables-save' command in Linux?

    • A.To set up the new iptables rules
    • B.To restore the saved iptables rules
    • C.To back up the live iptables rules
    • D.To delete the chosen iptables rules
    Show answerHide answer

    Correct answer: To back up the live iptables rules

    iptables-save prints the rules currently loaded in the kernel, and redirecting that output to a file (iptables-save > /etc/sysconfig/iptables on Red Hat systems) is how you are able 'To back up the live iptables rules'. 'To restore the saved iptables rules' is the job of iptables-restore, which reads that file back in. 'To set up the new iptables rules' is done with iptables -A or -I, and 'To delete the chosen iptables rules' with iptables -D.

  6. Which command in Linux is used to display the current SELinux security context?

    • A.ls -l
    • B.ls -Z
    • C.id -u
    • D.id -G
    Show answerHide answer

    Correct answer: ls -Z

    'ls -Z' adds each file's SELinux security context (user:role:type:level, such as system_u:object_r:httpd_sys_content_t:s0) to the listing. 'ls -l' gives the long listing of owner, group and permission bits but no SELinux label. 'id -u' prints only the numeric user ID and 'id -G' only the numeric group IDs, so neither shows a security context.

  7. In the context of Linux file permissions, what is the effect of setting a sticky bit on a directory?

    • A.You can read only files you own.
    • B.You can access its files only as root.
    • C.You can delete only files you own.
    • D.You can execute files with only read permission.
    Show answerHide answer

    Correct answer: You can delete only files you own.

    A sticky bit on a shared, writable directory such as /tmp means 'You can delete only files you own.': removing or renaming a file there needs its owner, the directory owner or root. 'You can read only files you own.' is wrong because opening and reading a file are still decided by that file's own permission bits. 'You can access its files only as root.' is wrong because the bit locks no one out of the directory; /tmp is mode 1777 and open to every user. 'You can execute files with only read permission.' is wrong because the bit grants no extra rights, so whether a file can run still depends on its own execute bits.

  8. Which command in Linux is used to verify the integrity of files and detect unauthorized changes, especially for system binaries and configuration files?

    • A.setfacl
    • B.tripwire
    • C.logwatch
    • D.getfacl
    Show answerHide answer

    Correct answer: tripwire

    'tripwire' records a database of cryptographic hashes and attributes for system binaries and configuration files, then reports any file that later changes, which is how it detects tampering. 'logwatch' summarizes log files into daily reports but does not check files against a baseline, 'getfacl' only displays a file's access control lists, and 'setfacl' changes those lists.

  9. In Linux, which type of encryption is used by the cryptsetup command when setting up disk encryption?

    • A.AES
    • B.RSA
    • C.DSA
    • D.DES
    Show answerHide answer

    Correct answer: AES

    cryptsetup sets up LUKS volumes, and its default cipher is 'AES' (aes-xts-plain64), the fast symmetric block cipher used for full-disk encryption. 'DES' is also a symmetric block cipher, but it is retired: its 56-bit key is far too weak to protect a disk today. 'RSA' is an asymmetric algorithm used for key exchange and signatures, far too slow for encrypting a whole disk, and 'DSA' is used only for digital signatures.

  10. What is the primary function of AppArmor in Linux?

    • A.Applying discretionary access control to files
    • B.Applying packet filtering rules to traffic
    • C.Applying password aging rules to accounts
    • D.Applying mandatory access controls to programs
    Show answerHide answer

    Correct answer: Applying mandatory access controls to programs

    AppArmor is a Linux Security Module whose job is 'Applying mandatory access controls to programs': each program gets a profile listing the files and capabilities it may use, and the kernel enforces it whatever the user's own rights. 'Applying discretionary access control to files' describes ordinary owner-set permissions and ACLs, 'Applying packet filtering rules to traffic' describes iptables or nftables, and 'Applying password aging rules to accounts' describes chage.

  11. Which Linux command is used to change the password expiry information for a user account?

    • A.chage
    • B.chown
    • C.chfn
    • D.chsh
    Show answerHide answer

    Correct answer: chage

    'chage' (change age) sets password-expiry data for an account: the maximum and minimum days between changes, the warning period, inactivity and the account expiry date, and chage -l lists them. 'chfn' changes the user's finger information, such as full name and phone, 'chsh' changes the login shell, and 'chown' changes the owner of a file.

  12. In Linux, what is the purpose of the sshd_config file?

    • A.To set the options of the SSH client
    • B.To set the options of the DNS daemon
    • C.To set the options of the SSH server
    • D.To set the options of the DNS client
    Show answerHide answer

    Correct answer: To set the options of the SSH server

    /etc/ssh/sshd_config is read by sshd, the OpenSSH server daemon, so its purpose is 'To set the options of the SSH server': the port, PermitRootLogin, PasswordAuthentication and other settings for incoming connections. 'To set the options of the SSH client' describes ssh_config, 'To set the options of the DNS client' describes /etc/resolv.conf, and 'To set the options of the DNS daemon' describes named.conf, the configuration of the BIND name server.

  13. What is the primary purpose of the iptables command in Linux?

    • A.Maintaining kernel routing tables
    • B.Specifying packet filtering rules
    • C.Capturing host network traffic
    • D.Listing open socket connections
    Show answerHide answer

    Correct answer: Specifying packet filtering rules

    iptables is the user-space front end to the kernel's netfilter tables, so its job is specifying packet filtering rules that accept, drop or reject traffic by address, port, protocol and connection state. Maintaining kernel routing tables is done with ip route; capturing host network traffic for analysis is what tcpdump does; listing open socket connections is the work of ss or netstat.

  14. Which command is used in Linux to generate key pairs for SSH?

    • A.ssh-agent
    • B.ssh-keygen
    • C.ssh-keyscan
    • D.ssh-copy-id
    Show answerHide answer

    Correct answer: ssh-keygen

    ssh-keygen generates the public/private key pair used for SSH key authentication (for example ssh-keygen -t ed25519), writing files such as ~/.ssh/id_ed25519 and id_ed25519.pub. ssh-keyscan only collects the existing public host keys of remote servers; ssh-copy-id installs a key you already have into a remote account's authorized_keys file; ssh-agent holds already-generated private keys in memory so you are not asked for the passphrase each time.

  15. In Linux, which file stores the local system's trusted CA (Certificate Authority) certificates?

    • A./etc/pki/tls/certs/localhost.crt
    • B./etc/pki/tls/private/localhost.key
    • C./etc/ssl/certs/ca-certificates.crt
    • D./etc/ssh/ssh_host_ecdsa_key.pub
    Show answerHide answer

    Correct answer: /etc/ssl/certs/ca-certificates.crt

    On Debian and Ubuntu, /etc/ssl/certs/ca-certificates.crt is the single bundle of trusted CA certificates that update-ca-certificates builds and that OpenSSL-based clients use to verify server certificates. /etc/pki/tls/certs/localhost.crt is the self-signed server certificate that mod_ssl creates on Red Hat systems, not a CA bundle; /etc/pki/tls/private/localhost.key is that certificate's private key; /etc/ssh/ssh_host_ecdsa_key.pub is the SSH server's public host key and has nothing to do with X.509 certificate authorities.

  16. What is the primary purpose of the fail2ban service in a Linux environment?

    • A.To spot and block repeated failed logins
    • B.To rotate and compress growing log files
    • C.To record and report kernel audit events
    • D.To scan and quarantine infected files
    Show answerHide answer

    Correct answer: To spot and block repeated failed logins

    fail2ban reads log files such as the SSH authentication log and, when one address racks up too many failures, adds a firewall rule that bans it for a set time - its purpose is to spot and block repeated failed logins, the signature of a brute-force attack. The service used to rotate and compress growing log files is logrotate; the daemon that exists to record and report kernel audit events is auditd, with aureport; a tool built to scan and quarantine infected files is an antivirus scanner such as ClamAV.

  17. Which Linux command is used for verifying the digital signatures of packages before installation?

    • A.gpg
    • B.aide
    • C.dpkg
    • D.sum
    Show answerHide answer

    Correct answer: gpg

    gpg (GNU Privacy Guard) checks a signature against the publisher's public key - for example gpg --verify package.tar.gz.sig package.tar.gz - proving the package is authentic and unaltered before you install it. dpkg unpacks and installs .deb files and, with Debian's default no-debsig setting, does not check signatures; aide compares files with a stored hash database to spot changes on a running system; sum only prints a checksum and block count, which can show corruption but not who signed the file.

  18. Which SELinux mode operates by logging actions that would have been denied in enforcing mode, but not actually preventing them?

    • A.Enforcing
    • B.Complain
    • C.Permissive
    • D.Unconfined
    Show answerHide answer

    Correct answer: Permissive

    In permissive mode SELinux still evaluates every access against the policy and writes AVC denial messages to the audit log, but it does not block the action, which is why it is used to troubleshoot a new policy. Enforcing mode both logs and blocks denied actions; complain is AppArmor's name for its log-only profile mode, not an SELinux mode; unconfined describes a process domain (such as unconfined_t) that the policy barely restricts, not a system-wide mode.

  19. What is the purpose of the chroot command in a Linux environment?

    • A.Changing the root directory of a process
    • B.Resetting the root password of a system
    • C.Checking the root filesystem of a server
    • D.Disabling the root account of a computer
    Show answerHide answer

    Correct answer: Changing the root directory of a process

    chroot starts a command (often a shell) with a chosen directory treated as /, so changing the root directory of a process confines which part of the filesystem it can see - the basis of a chroot jail and of rescue work on a mounted system. Resetting the root password of a system is done with passwd; checking the root filesystem of a server for errors is the job of fsck; disabling the root account of a computer is done with passwd -l root or usermod -L root.

  20. In Linux, what is the main function of the auditd daemon?

    • A.Receiving and routing syslog messages
    • B.Collecting and reporting crash dumps
    • C.Tracking and logging system events
    • D.Caching and checking user credentials
    Show answerHide answer

    Correct answer: Tracking and logging system events

    auditd is the user-space half of the Linux Auditing System: it receives the records the kernel produces for audit rules - file watches, system calls, logins, privilege changes - and writes them to /var/log/audit/audit.log, so its main function is tracking and logging system events for security review. Receiving and routing syslog messages is the job of rsyslogd; collecting and reporting crash dumps is the job of abrtd, or of kdump for kernel crashes; caching and checking user credentials is what sssd does.

  21. Which command in Linux is specifically used to update the user's password expiry information?

    • A.chage
    • B.usermod
    • C.gpasswd
    • D.pwconv
    Show answerHide answer

    Correct answer: chage

    chage (change age) edits the password-aging fields in /etc/shadow - maximum and minimum days, warning period, inactivity period and expiry date - for example chage -M 90 alice, while chage -l alice lists them. usermod changes general account properties such as groups or login shell (its -e option sets the account expiry date, not password aging); gpasswd administers groups and group passwords in /etc/gshadow; pwconv only builds /etc/shadow from /etc/passwd when shadow passwords are first enabled.

  22. In the context of Linux security, what does Mandatory Access Control MAC primarily focus on?

    • A.Permissions the owning user chooses
    • B.Privileges the job role determines
    • C.Capabilities the binary file holds
    • D.Rules the operating system enforces
    Show answerHide answer

    Correct answer: Rules the operating system enforces

    Under mandatory access control a central policy - SELinux labels or AppArmor profiles - decides what every process may do, and ordinary users, even file owners, cannot override it; the focus is rules the operating system enforces. Permissions the owning user chooses describe discretionary access control (DAC), the normal chmod and chown model; privileges the job role determines describe role-based access control (RBAC); capabilities the binary file holds are Linux file capabilities, set with setcap, which split up root's powers rather than enforcing one central policy.

  23. In Linux, which tool is used for creating and managing encrypted directories for storing sensitive data?

    • A.LUKS
    • B.GPG
    • C.EncFS
    • D.Tripwire
    Show answerHide answer

    Correct answer: EncFS

    EncFS is a FUSE filesystem that keeps each file encrypted inside an ordinary directory and shows a decrypted view at a mount point, so a user can create and manage encrypted directories without encrypting a whole disk. LUKS is the on-disk format for encrypting an entire partition or block device; GPG encrypts individual files rather than a mounted directory; Tripwire detects unauthorized changes to files but encrypts nothing.

  24. Which command is used to modify the SELinux context of a file or directory in Linux?

    • A.ls -Z
    • B.setsebool
    • C.getsebool
    • D.chcon
    Show answerHide answer

    Correct answer: chcon

    chcon (change context) rewrites the SELinux label on a file or directory, for example chcon -t httpd_sys_content_t /srv/www/index.html. ls -Z only displays the context a file already has; setsebool switches SELinux booleans on or off and getsebool reports their current values - neither changes a file's label.

  25. What is the primary role of the Linux PAM (Pluggable Authentication Modules) system?

    • A.Granting temporary root user privileges
    • B.Choosing account lookup data sources
    • C.Storing hashed user password entries
    • D.Unifying many separate login mechanisms
    Show answerHide answer

    Correct answer: Unifying many separate login mechanisms

    PAM is a library layer between programs such as login, sshd and sudo and the modules that actually check credentials (pam_unix, pam_sss, pam_ldap and others), configured per service in /etc/pam.d/ - its role is unifying many separate login mechanisms behind one interface, so applications need not know which one is in use. Granting temporary root user privileges is the job of sudo, which simply calls PAM to authenticate; choosing account lookup data sources is what /etc/nsswitch.conf does; storing hashed user password entries is the role of /etc/shadow.

  26. In Linux, which tool is used for scanning system logs and alerting based on predefined rules?

    • A.logwatch
    • B.logrotate
    • C.syslog-ng
    • D.logger
    Show answerHide answer

    Correct answer: logwatch

    logwatch, usually run daily from cron, works through the system logs for a chosen period, applies its per-service filter scripts and mails a summary report of anything noteworthy. logrotate only rotates, compresses and deletes old log files; syslog-ng is a logging daemon that collects messages and routes them to files or remote hosts; logger simply writes a message into the system log from the command line or a script.

  27. In Linux, which command is used to display SELinux security context of files?

    • A.ps -Z
    • B.ls -Z
    • C.id -Z
    • D.ss -Z
    Show answerHide answer

    Correct answer: ls -Z

    ls -Z adds each file's SELinux context (user:role:type:level, for example system_u:object_r:httpd_sys_content_t:s0) to the listing. ps -Z shows the contexts of running processes, id -Z shows the context of your own login session, and ss -Z shows the contexts of the processes that own network sockets - none of them reports the labels on files.

  28. Which feature in Linux allows for the execution of a program with the temporary privilege elevation of the executing user?

    • A.chmod
    • B.chroot
    • C.setuid
    • D.noexec
    Show answerHide answer

    Correct answer: setuid

    When an executable carries the setuid bit (set with chmod u+s and shown as an s in ls -l), it runs with the privileges of the file's owner instead of those of the user who started it - passwd relies on this to update /etc/shadow. chmod is only the command that changes permission bits, setuid among them, not the elevation mechanism itself; chroot confines a process to a different root directory rather than raising its privileges; noexec is a mount option that stops programs on a filesystem from executing at all.

  29. What does the umask command do in a Linux environment?

    • A.Edits access rights on existing files
    • B.Reassigns ownership on existing files
    • C.Determines default modes on new files
    • D.Sets immutable flags on system files
    Show answerHide answer

    Correct answer: Determines default modes on new files

    umask holds the bits that are removed from the default mode whenever a file or directory is created - with umask 022 new files get 644 and new directories 755 - so it determines default modes on new files, directories included. chmod is the command that edits access rights on existing files; chown is the one that reassigns ownership on existing files; chattr +i is what sets immutable flags on system files.

  30. Which Linux command is used to add new rules to the existing iptables configuration?

    • A.iptables -N
    • B.iptables -A
    • C.iptables -R
    • D.iptables -F
    Show answerHide answer

    Correct answer: iptables -A

    iptables -A (append) adds a new rule to the end of the chosen chain, for example iptables -A INPUT -p tcp --dport 22 -j ACCEPT. iptables -N creates a new user-defined chain rather than a rule; iptables -R replaces the rule at a given position instead of adding one; iptables -F flushes the chain, deleting every rule in it.

  31. Which type of firewall filtering technique inspects incoming network packets based on the state of the connection?

    • A.Stateful inspection
    • B.Stateless filtering
    • C.Content filtering
    • D.Application gateway
    Show answerHide answer

    Correct answer: Stateful inspection

    Stateful inspection keeps a connection-tracking table, so each incoming packet is judged against the state of the session it belongs to (NEW, ESTABLISHED, RELATED) - on Linux this is the conntrack match used by iptables and nftables. Stateless filtering judges every packet on its own by address, port and protocol; content filtering blocks traffic by URL, keyword or file type; an application gateway is a proxy that terminates and relays connections for one protocol rather than tracking connection state.

  32. In Linux, what does the getfacl command display?

    • A.Access control lists on files
    • B.SELinux context labels on files
    • C.Immutable attribute flags on files
    • D.Inode change timestamps on files
    Show answerHide answer

    Correct answer: Access control lists on files

    getfacl prints the access control lists on files and directories: the owner, group and other entries plus any named-user, named-group, mask and default entries added with setfacl. SELinux context labels on files are shown by ls -Z; immutable attribute flags on files, set with chattr +i, are listed by lsattr; inode change timestamps on files are reported by stat.

  33. Which command in Linux is used to update the Access Control Lists (ACLs) of a file or directory?

    • A.setfacl
    • B.getfacl
    • C.chmod
    • D.chattr
    Show answerHide answer

    Correct answer: setfacl

    setfacl adds, changes or removes ACL entries - for example setfacl -m u:alice:rw report.txt gives one extra user read-write access, and setfacl -x removes an entry. getfacl only displays the existing ACL; chmod changes the standard owner, group and other permission bits; chattr sets filesystem attributes such as immutable, not access control entries.

  34. What is the primary function of the rkhunter tool in Linux?

    • A.Probing ports and network services
    • B.Finding rootkits and similar malware
    • C.Recording logins and sudo commands
    • D.Filtering packets and blocking ports
    Show answerHide answer

    Correct answer: Finding rootkits and similar malware

    rkhunter (Rootkit Hunter) checks system binaries, hidden files, kernel modules and known file locations for signs of rootkits, backdoors and local exploits - its primary function is finding rootkits and similar malware. Probing ports and network services is the job of nmap; recording logins and sudo commands is handled by auditd and the system logs; filtering packets and blocking ports is the work of a firewall such as iptables or firewalld.

  35. What does the nmap command do in a Linux environment?

    • A.Discovers hosts and audits network security
    • B.Captures packets and decodes network frames
    • C.Filters packets and enforces firewall rules
    • D.Configures interfaces and assigns addresses
    Show answerHide answer

    Correct answer: Discovers hosts and audits network security

    nmap (Network Mapper) discovers hosts and audits network security: it scans address ranges and reports which hosts are up, which ports are open and which services and versions answer on them, which is why it is a standard security-audit tool. 'Captures packets and decodes network frames' describes tcpdump; 'filters packets and enforces firewall rules' describes iptables or nftables; and 'configures interfaces and assigns addresses' describes ip or nmcli.

  36. A new administrator asks what SELinux actually is and how it differs from standard Linux file permissions. Which description best characterizes SELinux?

    • A.A file permission extension that gives additional named users and groups fine-grained rights with setfacl
    • B.A host-based intrusion detection scanner that hunts rootkits and flags binaries with mismatched checksums
    • C.A kernel-level mandatory access control model that confines processes with labels and policy beyond discretionary permissions
    • D.A host-based dynamic firewall management daemon that associates interfaces with zones and writes corresponding netfilter rules
    Show answerHide answer

    Correct answer: A kernel-level mandatory access control model that confines processes with labels and policy beyond discretionary permissions

    SELinux (Security-Enhanced Linux) is best described as 'A kernel-level mandatory access control model that confines processes with labels and policy beyond discretionary permissions': every process and file carries a security context such as user:role:type, and the loaded policy decides access even for processes running as root, on top of the discretionary owner-group-other permissions. 'A file permission extension that gives additional named users and groups fine-grained rights with setfacl' describes POSIX access control lists, which are still set at the owner's discretion. 'A host-based intrusion detection scanner that hunts rootkits and flags binaries with mismatched checksums' describes tools such as rkhunter, and 'A host-based dynamic firewall management daemon that associates interfaces with zones and writes corresponding netfilter rules' describes firewalld.

  37. An administrator runs getenforce on a RHEL 9 server and it returns Permissive. The security team wants SELinux to actively block policy violations rather than just log them, but only temporarily until the next reboot for testing. Which command accomplishes this?

    • A.setenforce 0
    • B.setenforce 1
    • C.setsebool -P httpd_enable_homedirs 0
    • D.setsebool -P httpd_enable_homedirs 1
    Show answerHide answer

    Correct answer: setenforce 1

    setenforce 1 is correct: it switches the running system from permissive to enforcing mode at once, so policy violations are denied as well as logged, and the change lasts only until the next reboot because /etc/selinux/config is left untouched. setenforce 0 does the reverse and sets permissive mode. setsebool -P httpd_enable_homedirs 1 and setsebool -P httpd_enable_homedirs 0 only switch a single policy boolean (whether Apache may serve home directories) on or off and save it across reboots; neither changes the global mode, so SELinux stays permissive.

  38. During a security review, a colleague asks how SELinux and AppArmor differ in the way they identify and confine resources. Which statement correctly distinguishes them?

    • A.SELinux relies on owner and group permission bits, while AppArmor relies on access control lists
    • B.SELinux relies on security context labels, while AppArmor relies on per-program path profiles
    • C.SELinux relies on per-program path profiles, while AppArmor relies on security context labels
    • D.SELinux relies on access control lists, while AppArmor relies on owner and group permission bits
    Show answerHide answer

    Correct answer: SELinux relies on security context labels, while AppArmor relies on per-program path profiles

    The core difference is label-based versus path-based confinement: SELinux relies on security context labels, while AppArmor relies on per-program path profiles. SELinux attaches a context such as system_u:object_r:httpd_sys_content_t:s0 to every file and process and checks policy against those labels, whereas an AppArmor profile lists the filesystem paths and capabilities each program may use. The swapped statement (SELinux relies on per-program path profiles, while AppArmor relies on security context labels) reverses the two designs. Both remaining statements describe discretionary controls, yet SELinux and AppArmor are both mandatory access control systems layered on top of them: 'SELinux relies on owner and group permission bits, while AppArmor relies on access control lists' and 'SELinux relies on access control lists, while AppArmor relies on owner and group permission bits' are wrong in either order.

  39. An administrator on a RHEL 9 server wants to know what firewalld is and how it organizes rules. Which description is accurate?

    • A.A simplified firewall frontend that turns simple allow and deny commands into filters, using iptables as its default backend
    • B.A small intrusion prevention daemon that reads auth logs and bans source addresses, using firewall rules as its blocking method
    • C.A dynamically managed firewall daemon that sorts interfaces and sources into trust zones, using nftables as its default backend
    • D.A kernel packet filtering framework that replaced iptables as the firewall layer, using tables and chains as its rule hierarchy
    Show answerHide answer

    Correct answer: A dynamically managed firewall daemon that sorts interfaces and sources into trust zones, using nftables as its default backend

    firewalld is 'A dynamically managed firewall daemon that sorts interfaces and sources into trust zones, using nftables as its default backend': zones such as public, home, internal, dmz and trusted each carry a trust level, rule changes apply without flushing the whole ruleset, and RHEL 8 and later use nftables underneath (older releases used iptables). 'A simplified firewall frontend that turns simple allow and deny commands into filters, using iptables as its default backend' describes ufw on Ubuntu, which has no zones. 'A small intrusion prevention daemon that reads auth logs and bans source addresses, using firewall rules as its blocking method' describes fail2ban. 'A kernel packet filtering framework that replaced iptables as the firewall layer, using tables and chains as its rule hierarchy' describes nftables itself, which firewalld drives rather than replaces.

  40. On an Ubuntu 24.04 server an administrator needs to allow inbound SSH quickly and asks whether to use ufw or raw iptables. Which statement best describes the relationship between ufw and iptables?

    • A.ufw is a simplified front end that translates short commands into iptables rules, which netfilter then enforces
    • B.iptables is a simplified front end that translates short commands into ufw rules, which netfilter then enforces
    • C.ufw is a kernel module that bypasses iptables, then pushes nftables rules into netfilter
    • D.ufw is a firewalld wrapper that bypasses iptables, then writes zone rules into netfilter
    Show answerHide answer

    Correct answer: ufw is a simplified front end that translates short commands into iptables rules, which netfilter then enforces

    ufw is a simplified front end that translates short commands into iptables rules, which netfilter then enforces: running ufw allow 22/tcp replaces a longer hand-written iptables rule, and on Ubuntu 24.04 those iptables calls go through iptables-nft to the nftables kernel backend. The reversed claim that iptables is a simplified front end that translates short commands into ufw rules, which netfilter then enforces gets the two layers backwards. The claim that ufw is a kernel module that bypasses iptables, then pushes nftables rules into netfilter is wrong because ufw is a user-space program that calls iptables rather than bypassing it, and the claim that ufw is a firewalld wrapper that bypasses iptables, then writes zone rules into netfilter confuses it with firewalld, a separate zone-based tool.

Automation, Orchestration, and Scripting (61)

  1. In Linux, what is the function of the 'crontab' command?

    • A.To list background jobs
    • B.To schedule one-time jobs
    • C.To schedule periodic jobs
    • D.To kill background jobs
    Show answerHide answer

    Correct answer: To schedule periodic jobs

    crontab edits a user's cron table, whose entries tell the cron daemon to run commands automatically at set minutes, hours or days, so it is used 'To schedule periodic jobs'. 'To schedule one-time jobs' describes at, which runs a command once at a later time. 'To list background jobs' describes the shell's jobs builtin, and 'To kill background jobs' describes kill used with a job number such as kill %1.

  2. In Linux, what is the main function of the 'cron' daemon?

    • A.Collecting log messages from remote systems
    • B.Scheduling tasks to run at regular intervals
    • C.Queuing tasks to run once at a specific time
    • D.Accepting login sessions from remote systems
    Show answerHide answer

    Correct answer: Scheduling tasks to run at regular intervals

    The cron daemon wakes every minute, reads the crontab files and runs any job that is due, so its job is 'Scheduling tasks to run at regular intervals'. 'Queuing tasks to run once at a specific time' is the job of atd, the daemon behind the at command. 'Collecting log messages from remote systems' is done by a syslog daemon such as rsyslogd, and 'Accepting login sessions from remote systems' is done by sshd.

  3. In a Bash script, which statement is used to terminate a loop when a certain condition is met?

    • A.continue
    • B.done
    • C.exit
    • D.break
    Show answerHide answer

    Correct answer: break

    break leaves the innermost for, while or until loop at once, typically from inside an if test (break 2 leaves two nested loops). continue skips the rest of the current pass and starts the next iteration, so the loop keeps running; done only marks the end of the loop body in the syntax; exit ends the whole script rather than just the loop.

  4. In Bash scripting, what is the purpose of the trap command?

    • A.To send signals and kill user processes
    • B.To ignore hangups and keep jobs running
    • C.To pause scripts and await child jobs
    • D.To catch signals and run handler code
    Show answerHide answer

    Correct answer: To catch signals and run handler code

    trap registers commands for the shell to run when it receives a signal or a pseudo-signal such as EXIT or ERR - for example trap 'rm -f $tmpfile' EXIT INT TERM - so its purpose is to catch signals and run handler code. kill is the command used to send signals and kill user processes; nohup is used to ignore hangups and keep jobs running after you log out; wait is used to pause scripts and await child jobs started in the background.

  5. Which YAML key in a Docker Compose file specifies the custom build context for a service?

    • A.image
    • B.build
    • C.volumes
    • D.command
    Show answerHide answer

    Correct answer: build

    In a Compose file the build key tells Compose to build the service's image from a directory - build: ./app, or a mapping whose context and dockerfile sub-keys set the path and the file name. image names an image to pull or tag instead of a build context; volumes mounts host paths or named volumes into the container at run time; command only overrides the default command the container runs.

  6. In a Linux environment, what is the primary use of Ansible?

    • A.Managing and automating system configuration
    • B.Monitoring and graphing service availability
    • C.Building and running application containers
    • D.Scheduling and scaling container workloads
    Show answerHide answer

    Correct answer: Managing and automating system configuration

    Ansible connects to hosts over SSH and applies YAML playbooks idempotently, so its primary use is managing and automating system configuration, along with the application deployments built on it. Monitoring and graphing service availability is the job of tools such as Nagios or Zabbix; building and running application containers is what Docker does; scheduling and scaling container workloads is the role of Kubernetes.

  7. When writing a shell script, what is the purpose of the shebang (#!) at the start of the script?

    • A.To set the script's execute bit
    • B.To comment out the script's top line
    • C.To source the script's configuration
    • D.To declare the script's interpreter
    Show answerHide answer

    Correct answer: To declare the script's interpreter

    The #! line (for example #!/bin/bash or #!/usr/bin/env python3) tells the kernel which program should interpret the file when it is executed, so its purpose is to declare the script's interpreter. To set the script's execute bit you still need chmod +x; to source the script's configuration you run the source (or .) builtin on a settings file; and although the shell reads the line as a comment, using it to comment out the script's top line is not why it is there.

  8. Which command in a Linux shell script is used to iterate over a series of values?

    • A.while
    • B.until
    • C.for
    • D.do
    Show answerHide answer

    Correct answer: for

    for steps through a list of values one at a time - for host in web01 web02 web03; do ping -c 1 $host; done - or through a C-style counter, so it is the command for iterating over a series of values. while repeats as long as a test succeeds and until repeats until a test succeeds, both driven by a condition rather than a list; do is only the keyword that opens the body of a for, while or until loop and iterates over nothing by itself.

  9. In Docker, what is the main purpose of a 'volume'?

    • A.To throttle container processor usage
    • B.To hold scratch files in memory
    • C.To persist container data long term
    • D.To bundle app files and dependencies
    Show answerHide answer

    Correct answer: To persist container data long term

    A Docker volume is storage that Docker manages outside a container's writable layer, so files written there survive docker rm and can be mounted into a new container - its main purpose is to persist container data long term. The way to throttle container processor usage is a CPU limit such as --cpus; the way to hold scratch files in memory is a tmpfs mount, which is lost when the container stops; the way to bundle app files and dependencies is to build an image.

  10. What is the main purpose of the kubectl command in a Kubernetes environment?

    • A.To bootstrap control-plane nodes
    • B.To administer cluster resources
    • C.To start pods inside worker nodes
    • D.To build container images locally
    Show answerHide answer

    Correct answer: To administer cluster resources

    kubectl is the command-line client for the Kubernetes API server, used to create, inspect, scale and delete deployments, pods and services - in short, to administer cluster resources. kubeadm is the tool used to bootstrap control-plane nodes (kubeadm init, with kubeadm join adding workers); the kubelet agent is what is used to start pods inside worker nodes; docker build or a similar tool is used to build container images locally.

  11. In Linux scripting, what does the $$ variable represent?

    • A.The process ID of the last background job
    • B.The exit status of the last command run
    • C.The size of the positional parameter list
    • D.The process ID of the active shell script
    Show answerHide answer

    Correct answer: The process ID of the active shell script

    In Bash, $$ expands to the process ID of the shell itself, so inside a script it gives the process ID of the active shell script - handy for unique temporary file names such as /tmp/report.$$. The process ID of the last background job is held in $!; the exit status of the last command run is in $?; the size of the positional parameter list ($1, $2 and so on) is in $#.

  12. In Bash scripting, what does the set -e command do?

    • A.Exits the script on an unset variable
    • B.Exits the script on an error code
    • C.Prints each command before running it
    • D.Reads each command without running it
    Show answerHide answer

    Correct answer: Exits the script on an error code

    set -e (errexit) makes Bash stop as soon as a command returns a non-zero status, so it exits the script on an error code - at the first failing command - instead of carrying on. set -u is the option that exits the script on an unset variable; set -x prints each command before running it, for tracing; set -n reads each command without running it, which makes it a syntax check.

  13. Which file in a Git repository specifies intentionally untracked files to ignore?

    • A..gitignore
    • B..gitconfig
    • C..gitkeep
    • D..gitattributes
    Show answerHide answer

    Correct answer: .gitignore

    '.gitignore' lists patterns for intentionally untracked files that Git should ignore; files Git already tracks are not affected by it. '.gitconfig' holds a user's Git settings such as name, email and aliases, '.gitattributes' assigns per-path attributes such as line-ending handling, diff drivers or Git LFS filters, and '.gitkeep' is only a naming convention for an empty placeholder that lets an otherwise empty directory be committed; Git gives it no special meaning.

  14. What is the purpose of the cron daemon in Linux?

    • A.Launching periodic scheduled tasks
    • B.Executing deferred batch jobs once
    • C.Keeping system clocks synchronized
    • D.Recording service log messages
    Show answerHide answer

    Correct answer: Launching periodic scheduled tasks

    The cron daemon (crond) wakes every minute, reads the crontab files and starts any job whose schedule matches, so its purpose is 'Launching periodic scheduled tasks' such as nightly backups or log cleanup. 'Executing deferred batch jobs once' describes the at and batch commands and their atd daemon, which run a job a single time later on; 'Keeping system clocks synchronized' is the job of chronyd or ntpd, and 'Recording service log messages' is the job of rsyslogd or systemd-journald.

  15. In a Dockerfile, what does the CMD instruction do?

    • A.Executes the image build steps
    • B.Declares the environment variables
    • C.Records the intended network ports
    • D.Sets the container startup command
    Show answerHide answer

    Correct answer: Sets the container startup command

    CMD 'Sets the container startup command': it supplies the default command a container runs when it starts, and a command given to docker run overrides it. 'Executes the image build steps' describes RUN, which runs commands such as package installs while the image is built; 'Declares the environment variables' describes ENV, and 'Records the intended network ports' describes EXPOSE, which documents the ports the application listens on without publishing them.

  16. In Bash scripting, what does the $? variable represent?

    • A.The number of arguments the script received
    • B.The process ID of the latest background job
    • C.The exit status of the latest command run
    • D.The name of the currently running script
    Show answerHide answer

    Correct answer: The exit status of the latest command run

    In Bash, $? holds 'The exit status of the latest command run': 0 means success and any non-zero value means failure, which is why scripts test it right after a command. 'The number of arguments the script received' is $#, 'The process ID of the latest background job' is $!, and 'The name of the currently running script' is $0.

  17. Which Kubernetes object is used to manage a set of identical pods ensuring that a specified number of them are running at any given time?

    • A.Deployment
    • B.DaemonSet
    • C.ResourceQuota
    • D.NetworkPolicy
    Show answerHide answer

    Correct answer: Deployment

    A 'Deployment' declares how many replicas of an identical pod should run and, through the ReplicaSet it manages, keeps that many running while handling rolling updates and rollbacks. A 'DaemonSet' runs one copy of a pod on every node (or every selected node) rather than a chosen count, a 'ResourceQuota' only caps the resources and object counts a namespace may use, and a 'NetworkPolicy' controls which traffic may reach pods; neither of the last two creates or restarts pods.

  18. What is the primary use of the awk command in Linux scripting?

    • A.Searching input and printing matched lines
    • B.Processing text and extracting fields
    • C.Ordering lines and merging sorted files
    • D.Replacing characters and squeezing repeats
    Show answerHide answer

    Correct answer: Processing text and extracting fields

    awk splits each input line into fields and runs pattern-action rules on them, so its primary use is 'Processing text and extracting fields', for example printing selected columns or totaling a column into a report. 'Searching input and printing matched lines' is grep's job, 'Ordering lines and merging sorted files' is what sort does (sort -m merges), and 'Replacing characters and squeezing repeats' is what tr does (tr -s squeezes repeats).

  19. In the context of Git, what does the rebase command do?

    • A.Reverses earlier published changes
    • B.Integrates separate commit histories
    • C.Temporarily shelves uncommitted work
    • D.Downloads upstream branch changes
    Show answerHide answer

    Correct answer: Integrates separate commit histories

    git rebase replays the commits of one branch on top of another base, so it 'Integrates separate commit histories' into one linear history without a merge commit. 'Reverses earlier published changes' describes git revert, which adds a new commit that undoes an old one; 'Temporarily shelves uncommitted work' describes git stash, and 'Downloads upstream branch changes' describes git fetch, which updates remote-tracking branches without touching your own.

  20. What is the main function of a Makefile in software development?

    • A.Listing steps to build and run a container
    • B.Declaring options to start and stop a daemon
    • C.Defining rules to compile and link a program
    • D.Describing tasks to deploy and patch a host
    Show answerHide answer

    Correct answer: Defining rules to compile and link a program

    A Makefile's main function is 'Defining rules to compile and link a program': each rule names a target, its prerequisites and the commands that rebuild it, and make reruns only what is out of date. 'Listing steps to build and run a container' describes a Dockerfile, whose instructions build an image and set the command its containers run; 'Declaring options to start and stop a daemon' describes a systemd unit file, and 'Describing tasks to deploy and patch a host' describes an Ansible playbook.

  21. In a Linux environment, what is Jenkins primarily used for?

    • A.Container orchestration and scaling
    • B.Performance monitoring and alerting
    • C.Continuous integration and delivery
    • D.Server configuration and compliance
    Show answerHide answer

    Correct answer: Continuous integration and delivery

    Jenkins is an open-source automation server whose pipelines build, test and deploy code on every change, so it is used for 'Continuous integration and delivery' (CI/CD). 'Container orchestration and scaling' is the job of Kubernetes, 'Performance monitoring and alerting' is the job of tools such as Prometheus, Zabbix or Nagios, and 'Server configuration and compliance' is the job of tools such as Puppet or Ansible.

  22. In Linux, what does the sed command primarily perform?

    • A.Comparing file contents
    • B.Sorting input records
    • C.Paginating large output
    • D.Editing text streams
    Show answerHide answer

    Correct answer: Editing text streams

    sed, the stream editor, reads input line by line and applies editing commands such as s/old/new/ substitutions, so it primarily performs 'Editing text streams'. 'Comparing file contents' is the job of diff, 'Sorting input records' is the job of sort, and 'Paginating large output' is the job of a pager such as less or more.

  23. What is the primary function of the grep command in Linux?

    • A.Counting words and totaling bytes
    • B.Locating files and checking metadata
    • C.Searching text and matching patterns
    • D.Splitting lines and selecting fields
    Show answerHide answer

    Correct answer: Searching text and matching patterns

    grep reads text and prints the lines that match a regular expression, so its primary function is 'Searching text and matching patterns'. 'Counting words and totaling bytes' is what wc does, 'Locating files and checking metadata' is what find does with tests such as -name, -size and -mtime, and 'Splitting lines and selecting fields' is what cut does.

  24. In a Docker environment, what is the purpose of a Dockerfile?

    • A.To start the linked services for a Docker host
    • B.To set the engine options for a Docker host
    • C.To persist the app data for a Docker container
    • D.To list the build steps for a Docker image
    Show answerHide answer

    Correct answer: To list the build steps for a Docker image

    A Dockerfile is a text file of instructions (FROM, RUN, COPY, CMD and so on) that docker build runs in order, so its purpose is 'To list the build steps for a Docker image'. 'To start the linked services for a Docker host' describes a Compose file used with docker compose up, 'To set the engine options for a Docker host' describes the daemon.json configuration file, and 'To persist the app data for a Docker container' describes a Docker volume.

  25. In the context of Linux scripting, what does a #! followed by a path (e.g., #!/bin/bash) at the beginning of a script signify?

    • A.The comment delimiter
    • B.The execute permission bit
    • C.The interpreter directive
    • D.The executable search path
    Show answerHide answer

    Correct answer: The interpreter directive

    A first line beginning with #! (the shebang) is 'The interpreter directive': when the file is executed, the kernel runs the program named after it, such as /bin/bash, and hands it the script. It is not 'The comment delimiter'; a lone # starts a comment, but the #! pair is read by the kernel before any shell sees the file. 'The execute permission bit' is set separately with chmod +x, and 'The executable search path' is the PATH variable, the colon-separated list of directories the shell searches for commands, set in startup files such as ~/.bashrc.

  26. In Kubernetes, what is a 'Pod'?

    • A.The cluster worker machine
    • B.The configuration data store
    • C.The stable network endpoint
    • D.The smallest deployable unit
    Show answerHide answer

    Correct answer: The smallest deployable unit

    A Pod is 'The smallest deployable unit' in Kubernetes: one or more containers that share a network namespace and storage and are scheduled together onto a node. 'The cluster worker machine' is a node, 'The configuration data store' for non-secret key-value settings is a ConfigMap, and 'The stable network endpoint' in front of a set of pods is a Service.

  27. An administrator wants a backup script to run every 5 minutes. Which crontab entry accomplishes this?

    • A.* */5 * * * /opt/scripts/backup.sh
    • B.0 */5 * * * /opt/scripts/backup.sh
    • C.*/5 0 * * * /opt/scripts/backup.sh
    • D.*/5 * * * * /opt/scripts/backup.sh
    Show answerHide answer

    Correct answer: */5 * * * * /opt/scripts/backup.sh

    */5 * * * * /opt/scripts/backup.sh is correct: the first of the five time fields is the minute, and */5 there is a step value meaning every fifth minute (0, 5, 10 and so on up to 55), with the remaining fields set to * so it applies every hour of every day. * */5 * * * /opt/scripts/backup.sh puts the step in the hour field, so the job runs every minute but only during every fifth hour; 0 */5 * * * /opt/scripts/backup.sh runs once, at minute 0, of every fifth hour (00:00, 05:00, 10:00, 15:00 and 20:00); and */5 0 * * * /opt/scripts/backup.sh runs every five minutes but only between 00:00 and 00:55, because a 0 in the hour field means midnight rather than every hour.

  28. A new technician asks what a cron job is and where its schedule is stored. Which description is correct?

    • A.A command that atd runs once at a chosen future moment, stored in a /var/spool/at file
    • B.A command that crond runs unattended on a repeating schedule, stored in a crontab file
    • C.A command that init runs once during each machine startup, stored in a /etc/rc.local file
    • D.A command that systemd runs on a calendar schedule, stored in a matching .timer file
    Show answerHide answer

    Correct answer: A command that crond runs unattended on a repeating schedule, stored in a crontab file

    A cron job is 'A command that crond runs unattended on a repeating schedule, stored in a crontab file': the cron daemon reads user crontabs (edited with crontab -e) plus system files such as /etc/crontab and /etc/cron.d/, and runs each listed command whenever its five time fields match. 'A command that atd runs once at a chosen future moment, stored in a /var/spool/at file' describes an at job, which runs a single time. 'A command that init runs once during each machine startup, stored in a /etc/rc.local file' describes a boot-time script, not a recurring schedule. 'A command that systemd runs on a calendar schedule, stored in a matching .timer file' describes a systemd timer, the systemd alternative to cron rather than a cron job.

  29. An administrator must extract only the username (first colon-delimited field) from every line of /etc/passwd and also, in a separate task, replace all occurrences of 'tcp' with 'udp' in a config file. Which pairing of tools is the best fit?

    • A.sed for the field extraction and awk for the substitution
    • B.grep for the field extraction and tr for the substitution
    • C.tr for the field extraction and grep for the substitution
    • D.awk for the field extraction and sed for the substitution
    Show answerHide answer

    Correct answer: awk for the field extraction and sed for the substitution

    The best fit is awk for the field extraction and sed for the substitution. awk splits each line into fields on a chosen separator, so awk -F: '{print $1}' /etc/passwd prints just the username, while sed is a stream editor built for find-and-replace, so sed 's/tcp/udp/g' performs the substitution. The pairing sed for the field extraction and awk for the substitution swaps the two tools' strengths. The pairing grep for the field extraction and tr for the substitution fails because grep filters whole lines rather than splitting fields, and tr maps single characters (it would turn every t into u and every c into d) rather than replacing the word tcp. The pairing tr for the field extraction and grep for the substitution is wrong for both tasks, since tr cannot select a field and grep cannot replace text.

  30. An administrator needs to find every line in /var/log/syssetup.log that contains the word 'error' while ignoring case, and also display the line number of each match. Which grep command does this?

    • A.grep -is error /var/log/syssetup.log
    • B.grep -in error /var/log/syssetup.log
    • C.grep -on error /var/log/syssetup.log
    • D.grep -so error /var/log/syssetup.log
    Show answerHide answer

    Correct answer: grep -in error /var/log/syssetup.log

    grep -in error /var/log/syssetup.log is correct: -i makes the match case-insensitive (error, Error and ERROR all match) and -n prefixes each matching line with its line number. grep -is error /var/log/syssetup.log ignores case, but -s only suppresses error messages about missing or unreadable files, so no line numbers appear; grep -on error /var/log/syssetup.log adds line numbers, but -o prints only the matched text and the search stays case-sensitive, so Error and ERROR are missed; and grep -so error /var/log/syssetup.log makes both mistakes, staying case-sensitive and printing no line numbers.

  31. An administrator writes a Bash loop to ping three hosts listed in a variable. Which for loop syntax correctly iterates over the list?

    • A.foreach host (web01 web02 web03); do ping -c 1 $host; done
    • B.for host in web01 web02 web03 do ping -c 1 $host done
    • C.foreach host (web01 web02 web03) do ping -c 1 $host done
    • D.for host in web01 web02 web03; do ping -c 1 $host; done
    Show answerHide answer

    Correct answer: for host in web01 web02 web03; do ping -c 1 $host; done

    The correct syntax is for host in web01 web02 web03; do ping -c 1 $host; done. A Bash for loop takes the form for NAME in LIST; do COMMANDS; done: each word of the list is assigned to the variable in turn, and the semicolons (or newlines) end the list and the loop body. foreach host (web01 web02 web03); do ping -c 1 $host; done uses the csh foreach header with a parenthesized list, which Bash rejects as a syntax error; for host in web01 web02 web03 do ping -c 1 $host done leaves out the semicolons, so Bash reads do, ping and done as more list words and never finds the loop body; and foreach host (web01 web02 web03) do ping -c 1 $host done makes both mistakes.

  32. A script runs a command and the administrator checks $? immediately afterward, finding it holds the value 1. What does this most likely indicate?

    • A.The command failed, because 0 means success and 1 means general failure
    • B.The command succeeded, because 0 means false and 1 means true
    • C.The command was killed, because 0 means a clean exit and 1 means a hangup
    • D.The command wrote nothing, because 0 means nonempty output and 1 means empty output
    Show answerHide answer

    Correct answer: The command failed, because 0 means success and 1 means general failure

    The command failed, because 0 means success and 1 means general failure: $? holds the exit status of the most recent command, 0 is the only success value, and any nonzero value means failure, with 1 the usual general-error code. 'The command succeeded, because 0 means false and 1 means true' borrows the C convention, but in the shell an exit status of 0 is true and nonzero is false. 'The command was killed, because 0 means a clean exit and 1 means a hangup' is wrong because a process ended by a signal reports 128 plus the signal number, so SIGHUP gives 129. 'The command wrote nothing, because 0 means nonempty output and 1 means empty output' confuses the exit status with standard output, which $? does not measure.

  33. In a Bash script, which construct repeatedly executes a block of commands as long as a tested condition remains true?

    • A.An until loop
    • B.An if statement
    • C.A while loop
    • D.A case statement
    Show answerHide answer

    Correct answer: A while loop

    A while loop runs its body again and again for as long as its test command returns a true (zero) exit status, checking the condition before each pass. An until loop is the mirror image: it repeats while the condition is false and stops once it becomes true. An if statement tests a condition and runs its block once rather than repeatedly. A case statement picks a single branch by matching a value against patterns, so neither of these two loops.

  34. An administrator wants a Bash loop that keeps running until a service finally responds, stopping as soon as the condition becomes true. Which loop type is the most natural fit?

    • A.The until loop, which stops as soon as its test succeeds
    • B.The while loop, which stops as soon as its test fails
    • C.The for loop, which stops as soon as its word list runs out
    • D.The select loop, which stops as soon as its body runs break
    Show answerHide answer

    Correct answer: The until loop, which stops as soon as its test succeeds

    The natural fit is the until loop, which stops as soon as its test succeeds: it keeps running its body while the check fails, so until curl -s http://app/health; do sleep 5; done waits exactly until the service responds. The while loop, which stops as soon as its test fails, runs only while the check succeeds, the opposite of what is needed here. The for loop, which stops as soon as its word list runs out, repeats a fixed number of times and cannot wait on a runtime condition. The select loop, which stops as soon as its body runs break, builds an interactive numbered menu rather than polling a service.

  35. A script must take different actions depending on whether a variable named MODE equals start, stop, or restart, with a catch-all for anything else. Which Bash construct expresses this most cleanly?

    • A.An if statement that compares $MODE using -eq, with a closing else branch
    • B.A case statement that tests $MODE against patterns, with a *) default branch
    • C.A select loop that sets $MODE from a numbered menu, with a break exit branch
    • D.A getopts loop that parses $MODE as option letters, with a ?) failure branch
    Show answerHide answer

    Correct answer: A case statement that tests $MODE against patterns, with a *) default branch

    The cleanest construct is a case statement that tests $MODE against patterns, with a *) default branch: case $MODE in start) ... ;; stop) ... ;; restart) ... ;; *) ... ;; esac lists each value once, and the *) pattern catches anything else. An if statement that compares $MODE using -eq, with a closing else branch fails because -eq compares integers, so [ "$MODE" -eq start ] stops with an 'integer expression expected' error (strings are compared with =). A select loop that sets $MODE from a numbered menu, with a break exit branch prompts the user interactively instead of acting on the value already set. A getopts loop that parses $MODE as option letters, with a ?) failure branch is meant for single-letter command-line options such as -v, not whole words like start or stop.

  36. Inside an if statement, an administrator needs to check whether a regular file named /etc/app.conf exists before reading it. Which test expression is correct?

    • A.if [ -d /etc/app.conf ]; then
    • B.if [ -h /etc/app.conf ]; then
    • C.if [ -f /etc/app.conf ]; then
    • D.if [ -n /etc/app.conf ]; then
    Show answerHide answer

    Correct answer: if [ -f /etc/app.conf ]; then

    if [ -f /etc/app.conf ]; then is correct because the -f test is true only when the path exists and is a regular file. if [ -d /etc/app.conf ]; then tests for a directory instead; if [ -h /etc/app.conf ]; then tests whether the path is a symbolic link; and if [ -n /etc/app.conf ]; then only checks that the string /etc/app.conf is non-empty, which is always true and says nothing about whether the file exists.

  37. A Bash script assigns COUNT=5 and then runs total=$((COUNT * 3)). What value does total hold afterward?

    • A.15, because $(( )) performs integer arithmetic expansion
    • B.0, because $(( )) treats COUNT as unset without its $ sign
    • C.An error, because Bash needs the bc program to multiply
    • D.5 * 3, because Bash substitutes values but skips the math
    Show answerHide answer

    Correct answer: 15, because $(( )) performs integer arithmetic expansion

    total holds 15, because $(( )) performs integer arithmetic expansion: Bash evaluates the expression inside $((COUNT * 3)) with COUNT=5, computes 5 * 3 = 15 and substitutes that number. The answer 0, because $(( )) treats COUNT as unset without its $ sign is wrong because variable names inside $(( )) are expanded even without a leading .′Anerror,becauseBashneedsthebcprogramtomultiply′iswrongbecauseBashdoesintegermathnatively,andbcisneededonlyfordecimals.Theanswer5∗3,becauseBashsubstitutesvaluesbutskipsthemathdescribeswhattotal=". 'An error, because Bash needs the bc program to multiply' is wrong because Bash does integer math natively, and bc is needed only for decimals. The answer 5 * 3, because Bash substitutes values but skips the math describes what total="COUNT * 3" would store without $(( )); inside $(( )) the multiplication is carried out.

  38. A script references ${NAME:-guest}. What does this parameter expansion do?

    • A.Gives the value of NAME, or guest if NAME is unset or empty, and leaves NAME unchanged
    • B.Gives the value of NAME, or guest if NAME is unset or empty, and assigns guest to NAME
    • C.Gives guest instead of the value of NAME when set, and nothing if NAME is unset or empty
    • D.Gives the value of NAME, or stops and prints guest as an error if NAME is unset or empty
    Show answerHide answer

    Correct answer: Gives the value of NAME, or guest if NAME is unset or empty, and leaves NAME unchanged

    ${NAME:-guest} 'Gives the value of NAME, or guest if NAME is unset or empty, and leaves NAME unchanged': the :- operator only supplies a default for this one expansion. 'Gives the value of NAME, or guest if NAME is unset or empty, and assigns guest to NAME' describes ${NAME:=guest}, the assign-default form. 'Gives guest instead of the value of NAME when set, and nothing if NAME is unset or empty' describes ${NAME:+guest}, the alternate-value form. 'Gives the value of NAME, or stops and prints guest as an error if NAME is unset or empty' describes ${NAME:?guest}, which reports an error and exits a non-interactive shell.

  39. In a script, an administrator writes today=$(date +%F) to capture the current date into a variable. What is this technique called?

    • A.Process substitution, which runs the enclosed code and inserts its output as a path
    • B.Arithmetic expansion, which solves the enclosed math and inserts its integer result
    • C.Command substitution, which runs the enclosed code and inserts its standard output
    • D.Parameter expansion, which looks up the enclosed name and inserts its stored value
    Show answerHide answer

    Correct answer: Command substitution, which runs the enclosed code and inserts its standard output

    Writing today=$(date +%F) uses 'Command substitution, which runs the enclosed code and inserts its standard output': Bash runs date +%F, strips the trailing newline and assigns the text to today. 'Process substitution, which runs the enclosed code and inserts its output as a path' is the <(...) and >(...) syntax, which hands a /dev/fd path to another command. 'Arithmetic expansion, which solves the enclosed math and inserts its integer result' is the $((...)) syntax, and 'Parameter expansion, which looks up the enclosed name and inserts its stored value' is the ${...} syntax; neither runs a command.

  40. A Bash script needs to know how many arguments were passed on its command line. Which special parameter provides that count?

    • A.$#
    • B.$@
    • C.$*
    • D.$?
    Show answerHide answer

    Correct answer: $#

    The special parameter $# holds the number of positional arguments passed to the script or function. $@ expands to the arguments themselves as separate words, $* expands to the same arguments joined into one string when quoted, and $? holds the exit status of the last command, so none of them reports how many arguments there are.

  41. A script defines a function and inside it declares a variable with local count=0. Why use local here?

    • A.It copies count into the environment, so the child processes of the function inherit count
    • B.It preserves count between calls, so the function reuses the previous count each time
    • C.It confines count to the function, so the caller keeps its own separate count unchanged
    • D.It declares count as an integer, so the function evaluates count assignments as arithmetic
    Show answerHide answer

    Correct answer: It confines count to the function, so the caller keeps its own separate count unchanged

    Declaring local count=0 is correct here because 'It confines count to the function, so the caller keeps its own separate count unchanged': the variable exists only while the function runs and disappears when it returns, so a same-named variable in the calling code keeps its value. 'It copies count into the environment, so the child processes of the function inherit count' describes export. 'It preserves count between calls, so the function reuses the previous count each time' describes a C-style static variable, which Bash does not have; a local variable is created fresh on every call. 'It declares count as an integer, so the function evaluates count assignments as arithmetic' describes declare -i.

  42. An administrator runs the pipeline: awk -F: '$3 >= 1000 {print $1}' /etc/passwd. What does this command output?

    • A.The shell of each account whose UID is at least 1000
    • B.The username of each account whose GID is at least 1000
    • C.The shell of each account whose GID is at least 1000
    • D.The username of each account whose UID is at least 1000
    Show answerHide answer

    Correct answer: The username of each account whose UID is at least 1000

    The command prints 'The username of each account whose UID is at least 1000': -F: splits each /etc/passwd line on colons, $3 is the third field (the UID), the pattern $3 >= 1000 keeps only those lines, and {print $1} outputs the first field, the login name. 'The shell of each account whose UID is at least 1000' would need {print $7}, since the login shell is the seventh field. 'The username of each account whose GID is at least 1000' would need $4 >= 1000, since the primary GID is the fourth field, and 'The shell of each account whose GID is at least 1000' makes both field-numbering mistakes.

  43. In an awk program, what is the purpose of a BEGIN block?

    • A.It runs once before the first input line is read, typically to set variables or print a header
    • B.It runs once before each input record is read, typically to reset the fields or print a divider
    • C.It runs once after the last input line is read, typically to print totals or a summary
    • D.It runs once each time a new input file is read, typically to print the file name or a banner
    Show answerHide answer

    Correct answer: It runs once before the first input line is read, typically to set variables or print a header

    A BEGIN block is described by 'It runs once before the first input line is read, typically to set variables or print a header': awk executes it a single time before opening the input, which is why FS, counters and column headings are usually set there. 'It runs once after the last input line is read, typically to print totals or a summary' describes the END block. 'It runs once before each input record is read, typically to reset the fields or print a divider' describes nothing awk does with BEGIN; per-record work belongs in the main pattern-action rules. 'It runs once each time a new input file is read, typically to print the file name or a banner' describes gawk's separate BEGINFILE block, not BEGIN.

  44. An administrator needs to delete every line containing the word DEBUG from a log before archiving it, printing the cleaned result to standard output. Which sed command does this?

    • A.sed '/DEBUG/d' app.log
    • B.sed -n '/DEBUG/p' app.log
    • C.sed '/DEBUG/p' app.log
    • D.sed -n '/DEBUG/d' app.log
    Show answerHide answer

    Correct answer: sed '/DEBUG/d' app.log

    sed '/DEBUG/d' app.log is correct: the /DEBUG/ address selects every line containing DEBUG, the d command deletes those lines from the output, and every other line is printed to standard output as usual. sed -n '/DEBUG/p' app.log does the opposite, printing only the DEBUG lines; sed '/DEBUG/p' app.log keeps every line and prints the DEBUG lines a second time; and sed -n '/DEBUG/d' app.log prints nothing at all, because -n turns off automatic printing and d removes the matching lines anyway.

  45. A pattern must match either error or warning (whole alternatives) in a single grep invocation using extended regular expressions. Which command is correct?

    • A.grep -F 'error|warning' app.log
    • B.grep -E 'error\|warning' app.log
    • C.grep -F 'error\|warning' app.log
    • D.grep -E 'error|warning' app.log
    Show answerHide answer

    Correct answer: grep -E 'error|warning' app.log

    grep -E 'error|warning' app.log is correct: -E turns on extended regular expressions, in which an unescaped | means alternation, so lines containing either error or warning match. grep -F 'error|warning' app.log treats the whole pattern as a fixed string and only matches the literal text error|warning. grep -E 'error\|warning' app.log escapes the pipe, which in extended syntax makes it a literal | character instead of alternation. grep -F 'error\|warning' app.log searches for the literal text error\|warning, backslash included.

  46. A developer runs git clone https://example.com/app.git. What does this command accomplish?

    • A.It registers the URL as origin in the current repository but does not download its contents
    • B.It uploads local commits to a remote repository and updates the branches stored there
    • C.It downloads the repository and its history into a new directory linked to the source as origin
    • D.It downloads new commits from the URL into the current repository but leaves the working files alone
    Show answerHide answer

    Correct answer: It downloads the repository and its history into a new directory linked to the source as origin

    git clone is described by 'It downloads the repository and its history into a new directory linked to the source as origin': every file and commit is copied into a new app directory, and a remote named origin is configured to point back at the URL. 'It registers the URL as origin in the current repository but does not download its contents' describes git remote add origin. 'It downloads new commits from the URL into the current repository but leaves the working files alone' describes git fetch, which needs an existing repository. 'It uploads local commits to a remote repository and updates the branches stored there' describes git push.

  47. After committing work on a feature branch, a developer wants to integrate those commits into main. Which sequence is correct?

    • A.git checkout feature, then git merge main
    • B.git checkout main, then git pull feature
    • C.git checkout main, then git merge feature
    • D.git checkout feature, then git pull main
    Show answerHide answer

    Correct answer: git checkout main, then git merge feature

    The correct sequence is git checkout main, then git merge feature: the first command switches onto the branch that will receive the work, and the second combines the feature branch's commits into it. git checkout feature, then git merge main runs the merge in the wrong direction, bringing main's commits into feature while main itself is unchanged. git checkout main, then git pull feature fails because git pull expects a remote name such as origin, so feature is treated as an unknown remote, and git checkout feature, then git pull main makes both mistakes.

  48. A bad commit was already pushed and shared with the team. The developer wants to undo its changes by creating a new commit that reverses them, preserving history. Which command is appropriate?

    • A.git reset --hard <commit>
    • B.git cherry-pick <commit>
    • C.git reset <commit>
    • D.git revert <commit>
    Show answerHide answer

    Correct answer: git revert <commit>

    git revert <commit> is correct: it creates a new commit that applies the inverse of the bad commit's changes, so the shared history stays intact and teammates can simply pull the fix. git reset --hard <commit> moves the branch back and throws away later commits and changes, rewriting history that others already have; git reset <commit> also moves the branch back and rewrites history, only keeping the changes as unstaged edits; and git cherry-pick <commit> copies the commit's changes onto the current branch again instead of undoing them.

  49. To avoid committing an API key, a developer should add the credentials file to which Git mechanism, and what is a key caveat?

    • A.Add it to .gitignore, noting that it does not untrack a file already committed
    • B.Add it to .gitattributes, noting that it does not encrypt a file already committed
    • C.Add it to .gitkeep, noting that it does not shield a file already committed
    • D.Add it to .gitconfig, noting that it does not ignore a file already committed
    Show answerHide answer

    Correct answer: Add it to .gitignore, noting that it does not untrack a file already committed

    The right answer is 'Add it to .gitignore, noting that it does not untrack a file already committed': .gitignore stops Git from picking up untracked files, but a credentials file that was already committed stays tracked, so it must be removed with git rm --cached and purged from history. 'Add it to .gitattributes, noting that it does not encrypt a file already committed' is wrong because .gitattributes sets per-path attributes such as line endings and diff or merge drivers; it never ignores or encrypts files on its own. 'Add it to .gitkeep, noting that it does not shield a file already committed' is wrong because .gitkeep is only an empty placeholder that lets an empty directory be committed. 'Add it to .gitconfig, noting that it does not ignore a file already committed' is wrong because .gitconfig holds configuration settings such as user.name, not a list of files to ignore.

  50. An administrator runs: docker run -d --name web -p 8080:80 nginx. What does the 8080:80 portion do?

    • A.It forwards port 80 on the host to port 8080 in the container
    • B.It runs the container process as user 8080 and group 80
    • C.It runs the container process as user 80 and group 8080
    • D.It forwards port 8080 on the host to port 80 in the container
    Show answerHide answer

    Correct answer: It forwards port 8080 on the host to port 80 in the container

    -p 8080:80 publishes a port in host:container order, so 'It forwards port 8080 on the host to port 80 in the container': requests reaching the host on 8080 are passed to nginx listening on port 80 inside the container. 'It forwards port 80 on the host to port 8080 in the container' reverses the order of the two numbers. 'It runs the container process as user 8080 and group 80' and 'It runs the container process as user 80 and group 8080' confuse -p with -u, the option that takes a user:group pair; -p never changes which user the container runs as.

  51. Which docker run flag starts a container in the background (detached) so the shell prompt returns immediately?

    • A.-i
    • B.-t
    • C.-a
    • D.-d
    Show answerHide answer

    Correct answer: -d

    -d (--detach) runs the container in the background, prints its ID and returns the prompt immediately. -i keeps standard input open and -t allocates a pseudo-terminal (together, -it gives an interactive foreground session), while -a attaches the terminal to the container's STDIN, STDOUT or STDERR, which keeps it in the foreground; none of them detaches the container.

  52. A team wants to persist a database container's data so it survives container removal, using storage that Docker fully manages rather than a specific host path. Which option should they use?

    • A.A bind mount that links the database path to a host directory
    • B.A tmpfs mount that keeps the database files in host memory
    • C.A Docker restart policy that brings back the container after it exits
    • D.A named volume that Docker stores outside the container
    Show answerHide answer

    Correct answer: A named volume that Docker stores outside the container

    The right choice is 'A named volume that Docker stores outside the container' (for example -v dbdata:/var/lib/mysql): Docker creates and manages the volume in its own storage area, it outlives docker rm, and it is referenced by name rather than by a host path. 'A bind mount that links the database path to a host directory' would persist the data but ties it to a specific host path, which the team wants to avoid. 'A tmpfs mount that keeps the database files in host memory' keeps the data only in memory, so it is lost when the container stops. 'A Docker restart policy that brings back the container after it exits' (such as --restart always) restarts a stopped container but does nothing for data once the container is removed.

  53. In a Dockerfile, what is the difference between the build context and the Dockerfile itself?

    • A.The Dockerfile lists the steps; the context is the base image pulled to the host for FROM and RUN
    • B.The Dockerfile lists the steps; the context is the directory tree sent to the daemon for COPY and ADD
    • C.The Dockerfile lists the steps; the context is the argument values passed to the daemon for ARG and ENV
    • D.The Dockerfile lists the steps; the context is the image layers pushed to the registry for RUN and CMD
    Show answerHide answer

    Correct answer: The Dockerfile lists the steps; the context is the directory tree sent to the daemon for COPY and ADD

    'The Dockerfile lists the steps; the context is the directory tree sent to the daemon for COPY and ADD' is right: the Dockerfile holds the ordered instructions, while the build context is the directory tree handed to the Docker daemon at build time, and COPY and ADD take their local files only from inside it. 'The Dockerfile lists the steps; the context is the base image pulled to the host for FROM and RUN' confuses the context with the base image that FROM names. 'The Dockerfile lists the steps; the context is the argument values passed to the daemon for ARG and ENV' describes build arguments supplied with --build-arg, which are separate from the context. 'The Dockerfile lists the steps; the context is the image layers pushed to the registry for RUN and CMD' mixes it up with the finished image that docker push uploads, which is the build's output rather than its input.

  54. An administrator on RHEL runs containers with Podman as a non-root user. What is a defining advantage of this rootless model over the traditional Docker daemon?

    • A.Containers run as real root with no daemon, so the privileged ports open directly
    • B.Containers run as unprivileged UIDs with no root daemon, so the attack surface shrinks
    • C.Containers run as KVM guests with no root daemon, so the host kernel stays out of reach
    • D.Containers run as children of one root daemon with no extra setup, so the API handles restarts centrally
    Show answerHide answer

    Correct answer: Containers run as unprivileged UIDs with no root daemon, so the attack surface shrinks

    'Containers run as unprivileged UIDs with no root daemon, so the attack surface shrinks' is right: rootless Podman starts containers as the ordinary user, with container root mapped to that user's UID through a user namespace, and no root-owned daemon exists for an attacker to take over. 'Containers run as real root with no daemon, so the privileged ports open directly' is the common misreading; root inside a rootless container is only the ordinary user on the host, who cannot bind ports below 1024 unless net.ipv4.ip_unprivileged_port_start is lowered. 'Containers run as KVM guests with no root daemon, so the host kernel stays out of reach' describes virtual machines; containers share the host kernel. 'Containers run as children of one root daemon with no extra setup, so the API handles restarts centrally' is the traditional Docker model that rootless Podman avoids.

  55. Two containers on the same host must communicate by name (for example app reaching db). What is the recommended Docker approach?

    • A.Leave both on Docker's default bridge network, whose /etc/hosts file resolves each container name
    • B.Run both with --network host, so that app reaches db through the loopback address
    • C.Publish both containers' ports with -p, so that app reaches db through the network by IP address
    • D.Place both on one user-defined bridge network, whose embedded DNS resolves each container name
    Show answerHide answer

    Correct answer: Place both on one user-defined bridge network, whose embedded DNS resolves each container name

    'Place both on one user-defined bridge network, whose embedded DNS resolves each container name' is the recommended approach: a network made with docker network create gives every attached container Docker's embedded DNS, so app can reach db by name. 'Leave both on Docker's default bridge network, whose /etc/hosts file resolves each container name' is the classic trap, because the default bridge offers no automatic name resolution and only the deprecated --link flag wrote hosts entries. 'Run both with --network host, so that app reaches db through the loopback address' drops network isolation and reaches db at localhost, not by its container name. 'Publish both containers' ports with -p, so that app reaches db through the network by IP address' routes traffic by address rather than by container name.

  56. In container terminology, what is a registry?

    • A.A tool that builds and runs containers, such as Docker Engine or Podman
    • B.A platform that schedules services across hosts, such as Docker Swarm or Kubernetes
    • C.A file that defines and links multi-container services, such as Docker Compose YAML
    • D.A service that stores and distributes images, such as Docker Hub or Quay
    Show answerHide answer

    Correct answer: A service that stores and distributes images, such as Docker Hub or Quay

    'A service that stores and distributes images, such as Docker Hub or Quay' defines a registry: clients push images to it and pull images from it, and organizations often run private ones. 'A tool that builds and runs containers, such as Docker Engine or Podman' describes a container engine, which pulls from a registry but is not one. 'A platform that schedules services across hosts, such as Docker Swarm or Kubernetes' describes an orchestrator. 'A file that defines and links multi-container services, such as Docker Compose YAML' describes a Compose file, which may name images but stores none.

  57. A multi-container application needs the web tier scaled to three identical replicas with automatic restart if one dies. Which orchestration concept describes maintaining that desired number of running instances?

    • A.Applying a --restart unless-stopped policy so the engine revives each failed container instance
    • B.Autoscaling the desired replica count with a metrics policy that follows the load
    • C.Declaring the desired end state with a replica count the orchestrator keeps reconciling
    • D.Rolling out a new image gradually until the updated version runs on each instance
    Show answerHide answer

    Correct answer: Declaring the desired end state with a replica count the orchestrator keeps reconciling

    'Declaring the desired end state with a replica count the orchestrator keeps reconciling' is the concept: you state that three replicas should run, and the orchestrator continually compares the actual state with that target and replaces any instance that dies. 'Applying a --restart unless-stopped policy so the engine revives each failed container instance' restarts a container on one host but does not keep a replica count. 'Autoscaling the desired replica count with a metrics policy that follows the load' changes the target number rather than holding it steady. 'Rolling out a new image gradually until the updated version runs on each instance' is a rolling update, which deploys a version rather than maintaining a count.

  58. A colleague describes Ansible as idempotent. In the context of configuration management, what does idempotency mean?

    • A.A failed run of a playbook rolls every host back to the earlier state, so no partial change remains
    • B.A check run of a playbook reports what the tasks would change, without applying any of them
    • C.A single run of a playbook fires each notified handler once, however many of the tasks notify it
    • D.A repeat run of a playbook converges to the desired end state, leaving matching hosts untouched
    Show answerHide answer

    Correct answer: A repeat run of a playbook converges to the desired end state, leaving matching hosts untouched

    'A repeat run of a playbook converges to the desired end state, leaving matching hosts untouched' is idempotency: tasks describe a state, so running them again reports ok rather than changed once a host already matches. 'A failed run of a playbook rolls every host back to the earlier state, so no partial change remains' describes an atomic rollback, which Ansible does not perform. 'A check run of a playbook reports what the tasks would change, without applying any of them' is check mode (--check), a dry run. 'A single run of a playbook fires each notified handler once, however many of the tasks notify it' is how handlers behave, not what idempotency means.

  59. Ansible is frequently called agentless and described as using a push model. What does that imply about how it reaches managed nodes?

    • A.The control node pushes its changes out to each managed host, typically over SSH, leaving no agent behind
    • B.Each managed host runs a resident agent that pulls its settings, typically over HTTPS, so no push is needed
    • C.Each managed host runs ansible-pull, typically from cron, fetching its playbook from Git at set intervals
    • D.The control node installs a permanent agent on each managed host, typically over SSH, ready to take later pushes
    Show answerHide answer

    Correct answer: The control node pushes its changes out to each managed host, typically over SSH, leaving no agent behind

    'The control node pushes its changes out to each managed host, typically over SSH, leaving no agent behind' is what agentless push means: when a playbook runs, Ansible connects out (over OpenSSH by default, though it can also use other connection plugins, such as WinRM for Windows hosts), copies its modules over, runs them and removes them. 'The control node installs a permanent agent on each managed host, typically over SSH, ready to take later pushes' is the common misreading; nothing stays resident on the target. 'Each managed host runs a resident agent that pulls its settings, typically over HTTPS, so no push is needed' describes a pull model such as Puppet's. 'Each managed host runs ansible-pull, typically from cron, fetching its playbook from Git at set intervals' is Ansible's optional pull mode, the opposite of the push model in the stem.

  60. In an Ansible project, what is the role of the inventory file?

    • A.It lists the managed hosts and the groups that a play targets
    • B.It holds the ordered tasks and the modules that a play runs
    • C.It stores the encrypted passwords and keys that ansible-vault unlocks when a play starts
    • D.It sets the defaults, like remote_user and forks, that control how a play connects
    Show answerHide answer

    Correct answer: It lists the managed hosts and the groups that a play targets

    'It lists the managed hosts and the groups that a play targets' is the inventory's job: a play's hosts line can then name a group or pattern instead of individual addresses. 'It holds the ordered tasks and the modules that a play runs' describes a playbook. 'It stores the encrypted passwords and keys that ansible-vault unlocks when a play starts' describes a vault-encrypted vars file. 'It sets the defaults, like remote_user and forks, that control how a play connects' describes ansible.cfg.

  61. A CI/CD pipeline is configured so that every push to the main branch automatically builds the code, runs the test suite, and only proceeds to packaging if the tests pass. Which principle does the automatic build-and-test-on-every-push step embody?

    • A.Continuous deployment, where each passing change is automatically released to production without a manual approval step
    • B.Continuous integration, where each incoming change is automatically built and tested to catch bugs early
    • C.Continuous delivery, where each passing build is automatically packaged and held for a manual approval before its release
    • D.Continuous monitoring, where each running release is automatically watched in production
    Show answerHide answer

    Correct answer: Continuous integration, where each incoming change is automatically built and tested to catch bugs early

    'Continuous integration, where each incoming change is automatically built and tested to catch bugs early' is the principle behind building and testing on every push. 'Continuous delivery, where each passing build is automatically packaged and held for a manual approval before its release' describes the later packaging stage, not the build-and-test step. 'Continuous deployment, where each passing change is automatically released to production without a manual approval step' goes further still, shipping every green build. 'Continuous monitoring, where each running release is automatically watched in production' watches software after it ships rather than validating each change as it arrives.

Troubleshooting (60)

  1. What does the 'lsof' command do in Linux?

    • A.Lists loaded modules and their sizes
    • B.Lists filesystems and their free space
    • C.Lists directories and their disk usage
    • D.Lists open files and their processes
    Show answerHide answer

    Correct answer: Lists open files and their processes

    lsof (list open files) 'Lists open files and their processes': each line names a file, socket or device that is open and the command, PID and user of the process holding it. 'Lists loaded modules and their sizes' describes lsmod, 'Lists filesystems and their free space' describes df, and 'Lists directories and their disk usage' describes du.

  2. Which Linux command is used to view the kernel's message buffer?

    • A.dmesg
    • B.logger
    • C.sysctl
    • D.uname
    Show answerHide answer

    Correct answer: dmesg

    'dmesg' prints (and can clear) the kernel ring buffer, the messages the kernel logs about hardware, drivers and start-up. 'logger' writes a message into the system log rather than reading the kernel's buffer, 'sysctl' reads and sets kernel parameters, and 'uname' prints the kernel name, release and machine type.

  3. What is the primary purpose of the tcpdump tool in Linux?

    • A.Measuring link throughput
    • B.Tracing intermediate hops
    • C.Testing host reachability
    • D.Capturing network packets
    Show answerHide answer

    Correct answer: Capturing network packets

    tcpdump is a command-line packet analyzer: it listens on an interface, applies an optional filter such as port 22, and prints or saves (-w) each packet, so its primary purpose is capturing network packets to monitor traffic. Measuring link throughput is the job of iperf3; tracing intermediate hops toward a destination is what traceroute does; testing host reachability is done with ping.

  4. In Linux, what is the primary purpose of the ldd command?

    • A.Recording the system calls a program invokes
    • B.Showing the shared libraries a program needs
    • C.Printing the symbol table a program contains
    • D.Updating the linker cache a program consults
    Show answerHide answer

    Correct answer: Showing the shared libraries a program needs

    ldd prints each shared library a binary is linked against and the path the dynamic linker resolves it to - the first check when a program fails with a 'cannot open shared object file' error - so it is used for showing the shared libraries a program needs. Recording the system calls a program invokes is the job of strace; printing the symbol table a program contains is what nm does; updating the linker cache a program consults is the job of ldconfig.

  5. Which command is used in Linux to monitor real-time system resource usage, such as CPU and memory?

    • A.top
    • B.free
    • C.uptime
    • D.pstree
    Show answerHide answer

    Correct answer: top

    'top' gives a continuously refreshing, real-time view of CPU load, memory and swap use, and the busiest processes. 'free' prints memory and swap totals once and exits, 'uptime' prints a single line with the load averages, and 'pstree' draws the parent-child tree of processes without any resource figures, so none of them is a live monitor of CPU and memory.

  6. In Linux, when troubleshooting a network issue, which command can be used to trace the path packets take to reach a network host?

    • A.ifconfig
    • B.tcpdump
    • C.networkctl
    • D.traceroute
    Show answerHide answer

    Correct answer: traceroute

    'traceroute' sends probes with increasing TTL values so each router along the way answers in turn, listing every hop and its delay on the path to the host. 'ifconfig' shows local interface settings, 'tcpdump' captures the packets crossing a local interface, and 'networkctl' shows the status of links managed by systemd-networkd; none of them maps the route.

  7. Which Linux tool is used to diagnose and repair hard disk problems, including bad sectors?

    • A.fdisk
    • B.lsblk
    • C.partprobe
    • D.badblocks
    Show answerHide answer

    Correct answer: badblocks

    'badblocks' reads, or in write mode writes and verifies, every block of a device to find bad sectors, and its list can be passed to e2fsck so the filesystem stops using them. 'fdisk' edits partition tables, 'lsblk' lists block devices and their mount points, and 'partprobe' tells the kernel to re-read a changed partition table; none of them tests the disk surface.

  8. In Linux, what is the primary function of the strace command?

    • A.Recording system calls and signals
    • B.Logging library calls and arguments
    • C.Inspecting variables and stepping code
    • D.Inspecting packets and filtering ports
    Show answerHide answer

    Correct answer: Recording system calls and signals

    strace attaches to a process and prints each system call it makes, with arguments and return values, plus the signals it receives, so its primary function is 'Recording system calls and signals'. 'Logging library calls and arguments' describes ltrace, which watches shared-library functions instead of kernel calls; 'Inspecting variables and stepping code' describes the gdb debugger, and 'Inspecting packets and filtering ports' describes tcpdump.

  9. When a Linux system runs out of RAM and swap space, which kernel component is responsible for deciding which processes to kill to free up memory?

    • A.OOM killer
    • B.CFS scheduler
    • C.kswapd daemon
    • D.KSM daemon
    Show answerHide answer

    Correct answer: OOM killer

    When RAM and swap are exhausted, the kernel's 'OOM killer' scores processes by memory use (oom_score) and kills the worst offender to free memory. The 'CFS scheduler' decides which runnable process gets CPU time next, the 'kswapd daemon' reclaims memory in the background by writing pages out and freeing caches but never kills a process, and the 'KSM daemon' (ksmd) merges identical memory pages to save space.

  10. What is the purpose of the lsof command in a Linux system?

    • A.Showing mounted filesystems and their free space
    • B.Showing systemd log entries and their priorities
    • C.Printing running processes and their priorities
    • D.Listing open files and their owning processes
    Show answerHide answer

    Correct answer: Listing open files and their owning processes

    lsof (list open files) reports every file a process holds open, including sockets, pipes and devices, with its PID and user, so its purpose is 'Listing open files and their owning processes', for example to find what keeps a filesystem busy. 'Showing mounted filesystems and their free space' is df, 'Showing systemd log entries and their priorities' is journalctl, and 'Printing running processes and their priorities' is ps -l.

  11. Which command should be used to identify the presence of network packet loss in Linux?

    • A.arp
    • B.ping
    • C.host
    • D.curl
    Show answerHide answer

    Correct answer: ping

    'ping' sends a series of ICMP echo requests and ends with a summary such as '10 packets transmitted, 8 received, 20% packet loss', so it shows packet loss directly. 'arp' shows the cache that maps IP addresses to MAC addresses, 'host' looks up DNS records, and 'curl' transfers data from a URL; none of them measures lost packets.

  12. In Linux, what is the primary purpose of the dmesg command?

    • A.Printing the kernel ring buffer
    • B.Listing the loaded kernel modules
    • C.Listing the recent user sessions
    • D.Reading the systemd journal files
    Show answerHide answer

    Correct answer: Printing the kernel ring buffer

    dmesg reads the kernel's ring buffer, so its purpose is 'Printing the kernel ring buffer': boot-time hardware detection, driver messages and errors such as disk or USB faults. 'Listing the loaded kernel modules' is lsmod, 'Listing the recent user sessions' is last, and 'Reading the systemd journal files' is journalctl, whose -k option shows kernel messages from the journal.

  13. What does the fsck command do in a Linux system?

    • A.Checks and corrects filesystem errors
    • B.Reads and adjusts filesystem settings
    • C.Grows and shrinks filesystem capacity
    • D.Measures and reports filesystem usage
    Show answerHide answer

    Correct answer: Checks and corrects filesystem errors

    fsck (file system check) 'Checks and corrects filesystem errors' such as orphaned inodes and wrong link counts, usually on an unmounted filesystem after an unclean shutdown. 'Reads and adjusts filesystem settings' describes tune2fs, 'Grows and shrinks filesystem capacity' describes resize2fs, and 'Measures and reports filesystem usage' describes df.

  14. Which tool in Linux is used for interactive process manipulation, such as stopping and resuming processes?

    • A.ps
    • B.jobs
    • C.nice
    • D.htop
    Show answerHide answer

    Correct answer: htop

    'htop' is an interactive, full-screen process viewer: you select a process with the arrow keys and send it a signal such as SIGSTOP or SIGCONT to stop and resume it, or renice it, without typing PIDs. 'ps' prints a one-time snapshot and exits, 'jobs' only lists the current shell's background and stopped jobs (fg and bg are what resume them), and 'nice' starts a new command at an adjusted priority; none of them is an interactive process manager.

  15. In Linux, which command is used to test the reachability of a host on an Internet Protocol (IP) network?

    • A.ifconfig
    • B.ping
    • C.nslookup
    • D.route
    Show answerHide answer

    Correct answer: ping

    'ping' sends ICMP echo requests to a host and reports each reply and its round-trip time, the standard test of whether a host on an IP network is reachable. 'ifconfig' shows the local interface settings, 'nslookup' only resolves a name to an address through DNS, and 'route' prints or edits the local routing table; a name can resolve and a route can exist while the host is still unreachable.

  16. In Linux, which tool is typically used to monitor and interactively manage running processes?

    • A.lsof
    • B.htop
    • C.free
    • D.kill
    Show answerHide answer

    Correct answer: htop

    'htop' shows a live, scrollable list of processes with CPU and memory use and lets you kill, renice, filter or tree-view them from the keyboard, so it both monitors and manages them interactively. 'lsof' lists open files, 'free' reports memory totals, and 'kill' sends a signal to a process ID you already know; none of them gives an interactive view of running processes.

  17. When diagnosing disk space issues in Linux, which command displays the sizes of directories and their contents in a readable format?

    • A.df
    • B.du
    • C.lsblk
    • D.quota
    Show answerHide answer

    Correct answer: du

    'du' (disk usage) totals the space used by each directory and its contents, and du -sh * gives a readable per-directory summary to find what is filling a disk. 'df' reports free and used space per mounted filesystem, not per directory; 'lsblk' lists block devices and their sizes, and 'quota' shows a user's disk usage against their limits.

  18. What is the primary purpose of the tshark tool in a Linux environment?

    • A.Capturing and inspecting network packets
    • B.Scanning and fingerprinting remote hosts
    • C.Testing and benchmarking link throughput
    • D.Configuring and flushing kernel routes
    Show answerHide answer

    Correct answer: Capturing and inspecting network packets

    tshark is the command-line form of Wireshark: it captures packets from an interface or reads a capture file and decodes each protocol layer, so its purpose is 'Capturing and inspecting network packets'. 'Scanning and fingerprinting remote hosts' describes nmap, 'Testing and benchmarking link throughput' describes iperf3, and 'Configuring and flushing kernel routes' describes ip route.

  19. In Linux, which command can be used to display the current system load and CPU usage?

    • A.lscpu
    • B.nproc
    • C.uptime
    • D.sysctl
    Show answerHide answer

    Correct answer: uptime

    'uptime' prints one line with the current time, how long the system has been up, the number of logged-in users and the 1-, 5- and 15-minute load averages, the quick measure of how busy the system is. 'lscpu' describes the CPU architecture, cores and caches, 'nproc' prints how many processing units are available, and 'sysctl' reads or sets kernel parameters; none of them reports the current load.

  20. Which command in Linux is used to diagnose and isolate networking issues, reporting packet loss and latency?

    • A.ss
    • B.tcpdump
    • C.ping
    • D.netstat
    Show answerHide answer

    Correct answer: ping

    'ping' sends repeated ICMP echo requests and reports the round-trip time of each reply plus a closing packet-loss percentage, which is the loss-and-latency check used to isolate a network fault. 'ss' lists sockets and connections, 'tcpdump' captures raw packets for analysis without computing loss or round-trip statistics, and 'netstat' lists connections, routes and interface counters.

  21. What is the function of the smartctl tool in a Linux system?

    • A.Checking and repairing damaged filesystems
    • B.Creating and deleting disk partitions
    • C.Measuring and reporting disk throughput
    • D.Monitoring and controlling storage devices
    Show answerHide answer

    Correct answer: Monitoring and controlling storage devices

    smartctl, from the smartmontools package, is used for monitoring and controlling storage devices: it reads a drive's built-in SMART health data, starts the drive's self-tests and warns when a disk is likely to fail. Checking and repairing damaged filesystems is the job of fsck, which works on the filesystem rather than on the drive hardware; creating and deleting disk partitions is done with fdisk or parted; and measuring and reporting disk throughput is what iostat does.

  22. In Linux, which command is used to diagnose DNS resolution issues?

    • A.dig
    • B.arp
    • C.whois
    • D.route
    Show answerHide answer

    Correct answer: dig

    dig (Domain Information Groper) sends queries straight to DNS name servers and prints the full answer, the server that replied and the query time, which makes it the standard tool for diagnosing DNS resolution problems. arp deals with address resolution of a different kind, mapping IP addresses to MAC addresses on the local network, not host names to IP addresses; whois returns domain registration records rather than resolver answers; and route shows or changes the routing table rather than testing name resolution.

  23. Which tool in Linux provides real-time system monitoring, including CPU, memory, and I/O statistics?

    • A.mpstat
    • B.free
    • C.top
    • D.uptime
    Show answerHide answer

    Correct answer: top

    top gives a continuously refreshed, real-time view of the whole system: load, CPU usage (including I/O wait), memory and swap use, and the busiest processes. mpstat reports processor (CPU) statistics only, overall or per CPU, with nothing on memory; free prints a one-off snapshot of memory and swap usage; and uptime shows just the current time, how long the system has been running, the number of logged-in users and the load averages.

  24. In Linux, what is the primary purpose of the journalctl command?

    • A.Rotating oversized log files
    • B.Managing system service units
    • C.Forwarding log events remotely
    • D.Reading system journal entries
    Show answerHide answer

    Correct answer: Reading system journal entries

    journalctl is the systemd tool for reading system journal entries: it queries the log data that systemd-journald collects and can filter it by unit, boot, priority or time. Rotating oversized log files is the job of logrotate; managing system service units (start, stop, enable) is done with systemctl; and forwarding log events remotely is set up in a log daemon such as rsyslog, not done by journalctl.

  25. Which Linux command is used to list the status of ports (both listening and non-listening)?

    • A.netstat
    • B.ifconfig
    • C.iptables
    • D.arp
    Show answerHide answer

    Correct answer: netstat

    netstat lists sockets and their states; with -a it shows both listening ports and non-listening (established and other) connections, which is exactly the status of ports the question describes (ss is its modern replacement). ifconfig shows interface addresses and whether an interface is up, not port states; iptables lists firewall rules that may mention ports but not which ports are open or in use; and arp shows the IP-to-MAC address cache.

  26. In Linux, which command is used to identify the amount of time a system has been running along with the average load?

    • A.dmesg
    • B.uptime
    • C.vmstat
    • D.uname
    Show answerHide answer

    Correct answer: uptime

    uptime prints, in one line, the current time, how long the system has been running, the number of logged-in users and the 1-, 5- and 15-minute load averages. dmesg prints the kernel ring buffer, whose timestamps count seconds since boot but give no load figures; vmstat reports memory, swap, I/O and CPU activity without the uptime or the load averages; and uname prints the kernel name, release and hardware platform.

  27. What is the function of the iostat command in a Linux environment?

    • A.Reporting disk read and write rates
    • B.Reporting free memory and swap usage
    • C.Reporting network traffic and errors
    • D.Reporting open files and sockets
    Show answerHide answer

    Correct answer: Reporting disk read and write rates

    iostat is used for reporting disk read and write rates: for each device it shows transfers per second and kilobytes read and written per second (with -x, extended figures such as utilization), alongside an average CPU line. Reporting free memory and swap usage is what free does; reporting network traffic and errors per interface comes from ip -s link or netstat -i; and reporting open files and sockets is the job of lsof.

  28. Which command in Linux displays information about CPU architecture, including the number of CPUs, threads, cores, sockets, and more?

    • A.top
    • B.arch
    • C.nproc
    • D.lscpu
    Show answerHide answer

    Correct answer: lscpu

    lscpu gathers CPU architecture details from /proc/cpuinfo and sysfs and prints them in one table: architecture, number of CPUs, threads per core, cores per socket, sockets, caches and NUMA nodes. top shows live CPU usage, not the processor layout; arch prints only the machine hardware name (for example x86_64); and nproc prints a single number, the processing units available, with no cores, sockets or other architecture details.

  29. In Linux, which command is used for interactive monitoring of system calls made or received by a process?

    • A.strace
    • B.ltrace
    • C.lsof
    • D.pmap
    Show answerHide answer

    Correct answer: strace

    strace starts a program, or attaches to a running process with -p, and prints every system call it makes with its arguments and return value, plus the signals it receives. ltrace is the near miss: it traces calls into shared libraries and shows system calls only when -S is added; lsof lists the files and sockets a process has open; and pmap shows a process's memory map.

  30. Which tool in Linux is primarily used for diagnosing issues with the X Window System?

    • A.xdpyinfo
    • B.xwininfo
    • C.xauth
    • D.xhost
    Show answerHide answer

    Correct answer: xdpyinfo

    xdpyinfo queries the running X server and prints its capabilities: version, screens, resolution, color depths and the extensions it supports, which makes it the usual first check when diagnosing X Window System problems. xwininfo describes a single window (its geometry, depth and ID) rather than the server; xauth manages the authorization cookies clients use to connect; and xhost controls which hosts and users may connect to the X server.

  31. When troubleshooting a Linux system that is running slowly, which command is useful for identifying processes that are consuming excessive CPU or memory?

    • A.top
    • B.vmstat
    • C.pstree
    • D.lsof
    Show answerHide answer

    Correct answer: top

    top shows a live, regularly refreshed list of processes that can be sorted by %CPU or %MEM, so the processes consuming excessive CPU or memory rise to the head of the list. vmstat reports system-wide memory, swap and CPU figures but does not break them down by process; pstree shows which process started which, as a tree, with no CPU or memory figures; and lsof lists the files each process has open, not how much CPU or memory it uses.

  32. What is the purpose of the vmstat command in Linux?

    • A.Launching virtual machine instances
    • B.Adjusting virtual memory parameters
    • C.Resizing virtual machine disk files
    • D.Showing virtual memory statistics
    Show answerHide answer

    Correct answer: Showing virtual memory statistics

    vmstat is for showing virtual memory statistics: processes waiting to run, free, buffered and cached memory, swap in and out, block I/O, interrupts and CPU time, either once or repeatedly at a set interval. Adjusting virtual memory parameters such as vm.swappiness is done with sysctl, since vmstat only reports; launching virtual machine instances is the job of virsh, virt-install or another hypervisor tool; and resizing virtual machine disk files is done with qemu-img resize.

  33. Which Linux command can help identify and diagnose issues with the SSH (Secure Shell) service, such as connection and authentication problems?

    • A.ssh -q
    • B.ssh -l
    • C.ssh -v
    • D.ssh -t
    Show answerHide answer

    Correct answer: ssh -v

    ssh -v runs the SSH client in verbose mode, printing debug lines for each stage of the connection: the TCP connect, key exchange, host-key check and every authentication method tried, so it shows exactly where a connection or login fails (-vv and -vvv add more detail). ssh -q does the opposite and suppresses warnings and diagnostic messages; ssh -l only sets the login name to connect as, despite the letter; and ssh -t forces a pseudo-terminal for an interactive remote command.

  34. An administrator runs free -h on a server and sees that the used column is high but the available column also shows several gigabytes. The buff/cache column is large. What does the available value represent in this output?

    • A.The memory that neither processes nor caches are using, which leaves out the buff/cache figure
    • B.The memory the kernel holds as buffers and page cache, which it can reclaim without swapping
    • C.The estimated memory new programs can get without swapping, which includes reclaimable cache
    • D.The swap space still free on disk, which the kernel can page memory out to once it runs short
    Show answerHide answer

    Correct answer: The estimated memory new programs can get without swapping, which includes reclaimable cache

    'The estimated memory new programs can get without swapping, which includes reclaimable cache' is what the available column means, which is why a large buff/cache figure is healthy: the kernel hands that cache back on demand. 'The memory that neither processes nor caches are using, which leaves out the buff/cache figure' describes the free column, a poor health measure because Linux deliberately fills idle RAM with cache. 'The memory the kernel holds as buffers and page cache, which it can reclaim without swapping' describes the buff/cache column itself. 'The swap space still free on disk, which the kernel can page memory out to once it runs short' is reported on the Swap row, not in available.

  35. An administrator wants a quick, point-in-time summary of total, used, and available physical and swap memory in human-readable units, without watching it update continuously. Which command is the most direct choice?

    • A.free -h
    • B.top
    • C.swapon -s
    • D.cat /proc/meminfo
    Show answerHide answer

    Correct answer: free -h

    free -h prints a one-shot table of total, used, free, shared, buff/cache and available memory for both RAM and swap, in human-readable units such as Gi and Mi. cat /proc/meminfo shows the raw kernel counters in kB, dozens of lines long, rather than a concise human-readable summary. top shows the same totals in its header but keeps refreshing the screen, which is the continuous view the administrator wants to avoid. swapon -s summarizes swap devices only, not physical memory.

  36. On a server with a full root filesystem, df -h reports the partition is 100% used, but du -sh on every directory in that partition adds up to far less than the reported usage. What is the most likely cause?

    • A.A running process holds a deleted file open, so the blocks remain allocated
    • B.Blocks reserved for root by mkfs count as used, so df shows the partition as full
    • C.The du command counts a hard-linked file twice, so the totals come out wrong
    • D.The inode table has run out of entries, so df counts the remaining space as used
    Show answerHide answer

    Correct answer: A running process holds a deleted file open, so the blocks remain allocated

    'A running process holds a deleted file open, so the blocks remain allocated' is the classic cause: rm removes the directory entry, so du no longer sees the file, but the inode and data blocks stay in use until the process closes it, so df still counts them. lsof +L1 finds the process, and restarting it frees the space. 'Blocks reserved for root by mkfs count as used, so df shows the partition as full' is wrong because reserved blocks are not added to the Used figure. 'The du command counts a hard-linked file twice, so the totals come out wrong' is false; du counts a hard-linked file once, and over-counting would make du larger, not smaller. 'The inode table has run out of entries, so df counts the remaining space as used' confuses inode exhaustion, which df -i shows, with block usage.

  37. An administrator needs to find which subdirectories under /var are consuming the most disk space, sorted so the largest appears clearly. Which command is best suited to this task?

    • A.du -h --max-depth=0 /var | sort -h
    • B.du -h --max-depth=1 /var | sort -h
    • C.du -h --max-depth=1 /var | sort -n
    • D.du -h --max-depth=0 /var | sort -n
    Show answerHide answer

    Correct answer: du -h --max-depth=1 /var | sort -h

    du -h --max-depth=1 /var | sort -h totals each subdirectory of /var one level deep, and sort -h compares human-readable sizes such as 512M and 1.2G correctly, so the biggest subdirectory lands just above the /var total on the last line. du -h --max-depth=0 /var | sort -h prints only the single grand total for /var, the same as du -sh, so there is nothing to compare. du -h --max-depth=1 /var | sort -n has the right depth, but a plain numeric sort ignores the K, M and G suffixes, so 1.2G sorts below 512M and the ranking is wrong. du -h --max-depth=0 /var | sort -n makes both mistakes. Unlike df, which reports whole filesystems, du measures the space used beneath each directory.

  38. After a newly attached USB storage controller fails to appear as a usable device, an administrator wants to review the kernel's hardware and driver messages, including those generated since the system booted. Which command displays the kernel ring buffer with human-readable timestamps?

    • A.dmesg -w
    • B.lspci -k
    • C.lspci -v
    • D.dmesg -T
    Show answerHide answer

    Correct answer: dmesg -T

    dmesg -T prints the kernel ring buffer with human-readable wall-clock timestamps instead of seconds since boot, which makes it easy to match driver and probe messages to the moment the controller was attached. dmesg -w follows the ring buffer for new messages but keeps the seconds-since-boot stamps. lspci -k shows which kernel driver is bound to each PCI device, and lspci -v lists device details; neither displays the kernel's message log.

  39. An administrator runs ps aux to investigate a runaway service. Which statement correctly describes what the columns in ps aux output show?

    • A.A snapshot of processes on the current terminal, with PID, TTY, TIME and CMD columns
    • B.A snapshot of every user's processes, with USER, PID, %CPU, %MEM and COMMAND columns
    • C.A full-format snapshot of every process, with UID, PID, PPID, TTY and CMD columns
    • D.A live view of every user's busiest processes, with PID, USER, %CPU, %MEM and TIME+ columns
    Show answerHide answer

    Correct answer: A snapshot of every user's processes, with USER, PID, %CPU, %MEM and COMMAND columns

    'A snapshot of every user's processes, with USER, PID, %CPU, %MEM and COMMAND columns' describes ps aux: a selects processes with a terminal, x adds those without one, and u gives the user-oriented format, which also includes VSZ, RSS, TTY, STAT, START and TIME. 'A snapshot of processes on the current terminal, with PID, TTY, TIME and CMD columns' is plain ps with no options. 'A full-format snapshot of every process, with UID, PID, PPID, TTY and CMD columns' is ps -ef. 'A live view of every user's busiest processes, with PID, USER, %CPU, %MEM and TIME+ columns' is top, which keeps refreshing its display, whereas ps prints once.

  40. An administrator wants to find the single process consuming the most CPU at this moment and capture it for a script, without an interactive display. Which command accomplishes this?

    • A.ps -eo pid,pcpu,comm --sort=-pcpu | head
    • B.ps -eo pid,pmem,comm --sort=-pmem | head
    • C.ps -eo pid,time,comm --sort=-time | head
    • D.ps -eo pid,ni,comm --sort=-ni | head
    Show answerHide answer

    Correct answer: ps -eo pid,pcpu,comm --sort=-pcpu | head

    ps -eo pid,pcpu,comm --sort=-pcpu | head lists every process (-e) with custom columns (-o), sorted by CPU percentage in descending order, so the heaviest CPU users come first, just under the header, in plain, scriptable text. ps -eo pid,pmem,comm --sort=-pmem | head ranks by memory share instead. ps -eo pid,time,comm --sort=-time | head ranks by total CPU time accumulated since each process started, which favors long-running processes over the one busiest now. ps -eo pid,ni,comm --sort=-ni | head ranks by nice value, a scheduling priority rather than actual CPU use.

  41. An administrator prefers an interactive process monitor that supports color, mouse scrolling, tree view, and killing a process by selecting it from the list. Compared with top, which tool provides these features and how does it relate to top?

    • A.atop, an interactive monitor that records process activity to disk for later replay
    • B.htop, a friendlier interactive process viewer that default installs commonly omit
    • C.pstree, a static command that prints the process hierarchy in tree form
    • D.iotop, an interactive disk activity viewer that ranks processes by their read and write rates
    Show answerHide answer

    Correct answer: htop, a friendlier interactive process viewer that default installs commonly omit

    'htop, a friendlier interactive process viewer that default installs commonly omit' is right: htop adds color, mouse support, scrolling, a tree view and select-to-kill, while top ships in procps on nearly every system and htop usually has to be installed. 'atop, an interactive monitor that records process activity to disk for later replay' is best known for its logging and history, not point-and-kill selection. 'pstree, a static command that prints the process hierarchy in tree form' gives a tree but is not interactive and cannot signal processes. 'iotop, an interactive disk activity viewer that ranks processes by their read and write rates' focuses on disk I/O rather than replacing top.

  42. An administrator on a systemd-based server needs to review logs for a specific failed unit, filter to only the current boot, and show entries since one hour ago. What is journalctl and which invocation matches this need?

    • A.journalctl is the query tool for the systemd journal; journalctl -u nginx.service -b --since "1 hour ago"
    • B.journalctl is the query tool for the rsyslog files; journalctl -u nginx.service -b --since "1 hour ago"
    • C.journalctl is the query tool for the systemd journal; journalctl -u nginx.service -b -1 --since "1 hour ago"
    • D.journalctl is the query tool for the rsyslog files; journalctl -u nginx.service -b -1 --since "1 hour ago"
    Show answerHide answer

    Correct answer: journalctl is the query tool for the systemd journal; journalctl -u nginx.service -b --since "1 hour ago"

    'journalctl is the query tool for the systemd journal; journalctl -u nginx.service -b --since "1 hour ago"' is right: journalctl reads the structured journal that systemd-journald collects, and -u filters by unit, -b alone keeps the current boot, and --since limits entries to the last hour. 'journalctl is the query tool for the rsyslog files; journalctl -u nginx.service -b --since "1 hour ago"' gets the tool wrong; rsyslog's files under /var/log are read with ordinary text tools, not journalctl. 'journalctl is the query tool for the systemd journal; journalctl -u nginx.service -b -1 --since "1 hour ago"' selects the previous boot, because -b -1 counts back one boot. 'journalctl is the query tool for the rsyslog files; journalctl -u nginx.service -b -1 --since "1 hour ago"' makes both mistakes.

  43. A database server feels sluggish. An administrator runs vmstat 2 5 and notices the 'si' and 'so' columns consistently show large nonzero values while the 'wa' column is also high. What does this combination most strongly indicate?

    • A.Softirq load is high, so the CPU spends its time servicing interrupts, and that work stalls processes in I/O wait
    • B.File access is heavy, so ordinary reads and writes hit the disk, and that traffic stalls processes in I/O wait
    • C.Free RAM is short, so the kernel swaps pages heavily, and that paging stalls processes in I/O wait
    • D.Socket traffic is high, so the NIC queues are overflowing, and that backlog stalls processes in I/O wait
    Show answerHide answer

    Correct answer: Free RAM is short, so the kernel swaps pages heavily, and that paging stalls processes in I/O wait

    'Free RAM is short, so the kernel swaps pages heavily, and that paging stalls processes in I/O wait' is right: in vmstat, si and so are memory swapped in from and out to swap, and a high wa is CPU time spent waiting on that disk traffic, the signature of memory pressure. 'Softirq load is high, so the CPU spends its time servicing interrupts, and that work stalls processes in I/O wait' confuses vmstat's si with the si (software interrupt) field in top. 'File access is heavy, so ordinary reads and writes hit the disk, and that traffic stalls processes in I/O wait' describes the bi and bo columns, not si and so. 'Socket traffic is high, so the NIC queues are overflowing, and that backlog stalls processes in I/O wait' is wrong because vmstat does not report network traffic at all.

  44. While diagnosing slow writes on a server with several disks, an administrator wants per-device statistics showing utilization percentage and average wait time, refreshing every two seconds. Which command provides this?

    • A.iostat -c 2
    • B.pidstat -d 2
    • C.pidstat -u 2
    • D.iostat -x 2
    Show answerHide answer

    Correct answer: iostat -x 2

    iostat -x 2 prints extended per-device statistics, including %util (how busy each disk is) and r_await and w_await (average time read and write requests wait), every two seconds. iostat -c 2 shows only the CPU utilization report, with no device rows. pidstat -d 2 reports disk reads and writes per process rather than per device, and pidstat -u 2 reports CPU use per process; neither gives a device's utilization or wait time.

  45. An administrator needs to list all listening TCP ports along with the owning process name and PID, without performing slow DNS lookups. Which command is the correct modern choice?

    • A.ss -tlnp
    • B.ss -ulnp
    • C.netstat -tlnp
    • D.netstat -ulnp
    Show answerHide answer

    Correct answer: ss -tlnp

    ss -tlnp lists listening (-l) TCP (-t) sockets with numeric addresses and ports (-n) and the owning process name and PID (-p); ss is the modern replacement for netstat. ss -ulnp shows UDP sockets instead of TCP. netstat -tlnp gives the right columns but comes from the deprecated net-tools package, so it is not the modern choice, and netstat -ulnp is both deprecated and limited to UDP.

  46. Users report that a website loads when accessed by IP address but fails when accessed by hostname. An administrator suspects name resolution. Which command best tests whether a specific DNS record resolves and shows which server answered?

    • A.host www.example.com
    • B.ping -c 1 www.example.com
    • C.dig www.example.com
    • D.getent hosts www.example.com
    Show answerHide answer

    Correct answer: dig www.example.com

    dig www.example.com sends a DNS query and prints the answer section with the returned records plus a SERVER line naming the resolver that replied, so it shows both whether the name resolves and who answered. host www.example.com prints the resolved addresses in short form without naming the server unless -v is added. ping -c 1 www.example.com resolves the name only as a side effect and then tests reachability. getent hosts www.example.com resolves through the system's NSS order, which includes /etc/hosts, and never says which DNS server answered.

  47. An administrator must capture only DNS traffic (UDP port 53) arriving on interface eth0 and write it to a file for later analysis. Which tcpdump invocation is correct?

    • A.tcpdump -i eth0 udp port 53 -r dns.pcap
    • B.tcpdump -i eth0 tcp port 53 -w dns.pcap
    • C.tcpdump -i eth0 udp port 53 -w dns.pcap
    • D.tcpdump -i eth0 tcp port 53 -r dns.pcap
    Show answerHide answer

    Correct answer: tcpdump -i eth0 udp port 53 -w dns.pcap

    tcpdump -i eth0 udp port 53 -w dns.pcap listens on eth0 (-i), keeps only UDP traffic on port 53 through the filter expression, and writes the raw packets to dns.pcap (-w) for later analysis. tcpdump -i eth0 udp port 53 -r dns.pcap reads packets from an existing file instead of capturing, so it cannot create the file. tcpdump -i eth0 tcp port 53 -w dns.pcap captures TCP DNS traffic, such as zone transfers, rather than the UDP queries asked for. tcpdump -i eth0 tcp port 53 -r dns.pcap makes both mistakes.

  48. A network interface shows an IP address with ip addr but cannot reach any host on its subnet. Running ip link reveals the line 'state DOWN' for that interface. What is the most appropriate next action?

    • A.Assign the interface address again with ip addr add <addr> dev <iface>
    • B.Give the interface a gateway with ip route add default via <gw> dev <iface>
    • C.Switch the interface to promiscuous mode with ip link set dev <iface> promisc on
    • D.Bring the interface up administratively with ip link set dev <iface> up
    Show answerHide answer

    Correct answer: Bring the interface up administratively with ip link set dev <iface> up

    'Bring the interface up administratively with ip link set dev <iface> up' is the right next step: state DOWN means the link is not up, so no frames move even though an address is configured. 'Assign the interface address again with ip addr add <addr> dev <iface>' changes nothing, because the address is already present. 'Give the interface a gateway with ip route add default via <gw> dev <iface>' does not help, because hosts on the same subnet are reached directly, not through a gateway. 'Switch the interface to promiscuous mode with ip link set dev <iface> promisc on' only makes the NIC accept frames addressed to other hosts and leaves the link down.

  49. After editing /etc/fstab to add a new data partition, a server fails to finish booting and drops to an emergency shell. What is the most likely cause and the safest first diagnostic step?

    • A.After the /etc/fstab edit, a missing disk driver blocked the boot; read the journal, then rebuild the initramfs with dracut -f
    • B.After the /etc/fstab edit, a wrong SELinux label blocked the boot; read the journal, then touch /.autorelabel and reboot
    • C.After the /etc/fstab edit, a bad mount entry blocked the boot; read the journal, then remount / read-write and fix the faulty line
    • D.After the /etc/fstab edit, a stale GRUB configuration blocked the boot; read the journal, then regenerate grub.cfg with grub2-mkconfig
    Show answerHide answer

    Correct answer: After the /etc/fstab edit, a bad mount entry blocked the boot; read the journal, then remount / read-write and fix the faulty line

    'After the /etc/fstab edit, a bad mount entry blocked the boot; read the journal, then remount / read-write and fix the faulty line' fits the timing: systemd cannot complete the new mount, so it drops to the emergency shell, and mount -o remount,rw / lets the administrator correct the file. 'After the /etc/fstab edit, a missing disk driver blocked the boot; read the journal, then rebuild the initramfs with dracut -f' does not fit, because a data partition is mounted after the switch to the real root filesystem, where the installed kernel modules are available, so the initramfs is not involved. 'After the /etc/fstab edit, a wrong SELinux label blocked the boot; read the journal, then touch /.autorelabel and reboot' is unlikely, because a bad label causes access denials once the system is up, not a failed mount. 'After the /etc/fstab edit, a stale GRUB configuration blocked the boot; read the journal, then regenerate grub.cfg with grub2-mkconfig' would stop the system at the boot loader, before any filesystem from fstab is mounted.

  50. A systemd service refuses to start. Running systemctl status myapp.service shows 'Active: failed' and a 'Result: exit-code' line. Which command gives the most detailed application log output to determine why it exited?

    • A.systemctl help myapp.service
    • B.journalctl -t myapp.service -e
    • C.systemctl show myapp.service
    • D.journalctl -u myapp.service -e
    Show answerHide answer

    Correct answer: journalctl -u myapp.service -e

    journalctl -u myapp.service -e shows that unit's journal entries and jumps to the end (-e, which also caps the view at the last 1,000 lines), where the latest failure and the program's own error output sit; systemctl status only shows the last few lines. journalctl -t myapp.service -e filters on a syslog identifier rather than a unit, and the identifier is the program's own name, such as myapp, not myapp.service, so it returns nothing useful. systemctl help myapp.service opens the manual pages listed in the unit's Documentation= setting, and systemctl show myapp.service dumps the unit's properties; neither contains the application's log output.

  51. A user reports that running a script returns 'Permission denied' even though they own the file and it contains valid commands. ls -l shows -rw-r--r-- for the script. What is the most likely cause?

    • A.The filesystem is mounted noexec, so the kernel refuses to start scripts or binaries stored there
    • B.The script lacks a #! line, so the kernel does not know which shell or interpreter to start
    • C.The script has carriage-return line endings, so its #! interpreter path looks broken
    • D.The execute bit is unset, so the script needs chmod or a direct interpreter invocation to run
    Show answerHide answer

    Correct answer: The execute bit is unset, so the script needs chmod or a direct interpreter invocation to run

    'The execute bit is unset, so the script needs chmod or a direct interpreter invocation to run' matches -rw-r--r--, which grants no execute permission to anyone; chmod +x script.sh, or running it as bash script.sh, fixes it. 'The filesystem is mounted noexec, so the kernel refuses to start scripts or binaries stored there' can also give Permission denied, but the mode shown already explains the error without assuming an unusual mount option. 'The script lacks a #! line, so the kernel does not know which shell or interpreter to start' would not produce Permission denied; the calling shell simply runs it as a shell script. 'The script has carriage-return line endings, so its #! interpreter path looks broken' produces a bad interpreter error instead.

  52. A web server process cannot write to /var/www/html even though standard file permissions appear correct, and the audit log shows 'avc: denied' messages. SELinux is in enforcing mode. Which command identifies whether the file's SELinux type is the cause?

    • A.getsebool -a | grep httpd
    • B.ps -eZ | grep httpd
    • C.ls -Z /var/www/html
    • D.getfacl /var/www/html
    Show answerHide answer

    Correct answer: ls -Z /var/www/html

    ls -Z /var/www/html shows the SELinux context of the files, including the type label (for example httpd_sys_content_t versus httpd_sys_rw_content_t), which decides whether the web server's domain may write there. ps -eZ | grep httpd shows the context of the web server process, not of the files it is denied. getsebool -a | grep httpd lists the httpd SELinux booleans, which are policy switches, not the files' type label. getfacl /var/www/html shows POSIX access control lists, which are standard permissions and say nothing about SELinux types.

  53. On a busy server, an administrator runs uptime and sees load averages of 24.0, 18.5, 6.2 on a machine with 8 CPU cores. How should these numbers be interpreted?

    • A.Badly overloaded and subsiding: about three runnable or blocked tasks for each core, with the oldest figure first
    • B.Lightly loaded and climbing: each value a CPU percentage still short of full, with the newest figure first
    • C.Badly overloaded and climbing: about three runnable or blocked tasks for each core, with the newest figure first
    • D.Lightly loaded and subsiding: each value a CPU percentage still short of full, with the oldest figure first
    Show answerHide answer

    Correct answer: Badly overloaded and climbing: about three runnable or blocked tasks for each core, with the newest figure first

    'Badly overloaded and climbing: about three runnable or blocked tasks for each core, with the newest figure first' is right: uptime lists the 1-, 5- and 15-minute averages in that order, so 24.0 is the latest, and 24 tasks running, waiting to run or blocked on I/O across 8 cores is roughly three per core. 'Badly overloaded and subsiding: about three runnable or blocked tasks for each core, with the oldest figure first' reads the order backwards. 'Lightly loaded and climbing: each value a CPU percentage still short of full, with the newest figure first' treats load average as a percentage, which it is not. 'Lightly loaded and subsiding: each value a CPU percentage still short of full, with the oldest figure first' makes both mistakes.

  54. A service that worked yesterday now fails immediately on start. The administrator wants to see only error-priority and worse messages from the journal for the current boot. Which command filters by message priority correctly?

    • A.journalctl -b -p crit
    • B.journalctl -b -p warning
    • C.journalctl -b -p alert
    • D.journalctl -b -p err
    Show answerHide answer

    Correct answer: journalctl -b -p err

    journalctl -b -p err keeps the current boot (-b) and shows messages at priority err and above (err, crit, alert and emerg), which is exactly error-priority and worse. journalctl -b -p crit starts one level higher, so it hides plain err messages. journalctl -b -p warning also lets warnings through. journalctl -b -p alert is narrower still, showing only alert and emerg messages.

  55. An administrator tries to mount a newly created ext4 partition and receives 'mount: wrong fs type, bad option, bad superblock'. The device exists and is healthy. Which command best confirms the actual filesystem type so the correct type can be specified or repaired?

    • A.blkid /dev/sdb1
    • B.df -Th /dev/sdb1
    • C.fdisk -l /dev/sdb
    • D.badblocks -v /dev/sdb
    Show answerHide answer

    Correct answer: blkid /dev/sdb1

    blkid /dev/sdb1 reads the signature on the partition and reports its TYPE (ext4, xfs and so on) and UUID, which confirms what filesystem is actually there so the right -t value or fsck tool can be used. df -Th /dev/sdb1 reports types only for mounted filesystems, and this partition failed to mount, so it shows the filesystem holding /dev instead. fdisk -l /dev/sdb shows partition types such as Linux filesystem, which is a label in the partition table, not the filesystem written inside. badblocks -v /dev/sdb scans for unreadable sectors, which is not in doubt on a healthy device.

  56. A system boots but hangs for about 90 seconds before reaching the login prompt. The administrator suspects a slow-starting unit and wants to see how long each unit took to initialize. Which command provides a per-unit startup time breakdown?

    • A.systemd-analyze time
    • B.systemd-analyze blame
    • C.systemctl list-jobs
    • D.systemctl list-units --failed
    Show answerHide answer

    Correct answer: systemd-analyze blame

    systemd-analyze blame lists every unit started during boot, ordered by how long each took to initialize, so the unit behind a 90-second delay sits at the top. systemd-analyze time gives only the total boot time split into kernel, initrd and userspace, with no per-unit breakdown. systemctl list-jobs shows jobs still queued right now, which is empty once boot has finished. systemctl list-units --failed lists units that failed, and a slow unit usually succeeds eventually.

  57. A server randomly kills a large in-memory process during traffic spikes. Reviewing dmesg, the administrator finds lines containing 'Out of memory: Killed process'. Beyond adding RAM, which kernel-level adjustment can protect a critical process from being chosen as the victim?

    • A.Lower its OOM score by writing a negative value to /proc/<pid>/oom_score
    • B.Lower its OOM score by writing a negative value to /proc/<pid>/oom_score_adj
    • C.Give it the highest scheduling priority with renice so that the OOM killer passes it over
    • D.Launch it under nohup so that the kill signal from the OOM killer is ignored
    Show answerHide answer

    Correct answer: Lower its OOM score by writing a negative value to /proc/<pid>/oom_score_adj

    'Lower its OOM score by writing a negative value to /proc/<pid>/oom_score_adj' is the supported adjustment: a negative value, down to -1000, makes the OOM killer less likely to choose that process. 'Lower its OOM score by writing a negative value to /proc/<pid>/oom_score' names the read-only file that only reports the current score, so the write fails. 'Give it the highest scheduling priority with renice so that the OOM killer passes it over' confuses CPU scheduling priority with OOM selection. 'Launch it under nohup so that the kill signal from the OOM killer is ignored' fails because nohup only ignores SIGHUP, while the OOM killer sends SIGKILL, which cannot be caught or ignored.

  58. An administrator needs to verify two-way connectivity and identify exactly which hop along the path to a remote server is introducing high latency, combining a continuous traceroute with live ping statistics. Which tool is purpose-built for this?

    • A.traceroute remote.example.com
    • B.mtr remote.example.com
    • C.tracepath remote.example.com
    • D.ping remote.example.com
    Show answerHide answer

    Correct answer: mtr remote.example.com

    mtr remote.example.com combines traceroute and ping in one continuously updating display, showing loss and latency for every hop, so the hop that adds delay stands out. traceroute remote.example.com maps the path once, with three probes per hop, and then stops. tracepath remote.example.com also traces the path once, mainly to discover the path MTU. ping remote.example.com measures round-trip latency to the destination only and says nothing about the hops in between.

  59. A disk-related error appears in the logs and the administrator wants to check the drive's SMART health attributes, such as reallocated sector count, to decide whether the disk is failing. Which command queries this data?

    • A.hdparm -i /dev/sda
    • B.smartctl -i /dev/sda
    • C.smartctl -a /dev/sda
    • D.hdparm -a /dev/sda
    Show answerHide answer

    Correct answer: smartctl -a /dev/sda

    smartctl -a /dev/sda prints all SMART information, including the attribute table with Reallocated_Sector_Ct and the overall health assessment, which is what decides whether the drive is failing. smartctl -i /dev/sda prints only the identity section (model, serial, firmware and whether SMART is supported), with no attributes. hdparm -i /dev/sda lists the identification data the kernel driver recorded at boot, and hdparm -a /dev/sda shows the read-ahead setting; neither reports SMART attributes.

  60. An administrator changed a setting in /etc/systemd/system/myapp.service but restarting the service still uses the old configuration. What step was most likely skipped?

    • A.Reloading the unit files with systemctl daemon-reload so the edited myapp.service is reread
    • B.Reloading the service itself with systemctl reload myapp.service so it rereads its own settings
    • C.Clearing the failed state with systemctl reset-failed myapp.service ahead of the restart
    • D.Restarting the journal service with systemctl restart systemd-journald so the edit is recorded
    Show answerHide answer

    Correct answer: Reloading the unit files with systemctl daemon-reload so the edited myapp.service is reread

    'Reloading the unit files with systemctl daemon-reload so the edited myapp.service is reread' is the skipped step: systemd keeps unit definitions in memory, so after a unit file changes, a restart reuses the old definition until the manager reloads. 'Reloading the service itself with systemctl reload myapp.service so it rereads its own settings' asks the application to reload its own configuration, not systemd's copy of the unit. 'Clearing the failed state with systemctl reset-failed myapp.service ahead of the restart' only clears a failure record. 'Restarting the journal service with systemctl restart systemd-journald so the edit is recorded' restarts logging and has nothing to do with unit definitions.

References

  1. 1.CompTIA. “Linux+ Certification V8 (official overview).” CompTIA, 2026. ↑
  2. 2.CompTIA. “The New CompTIA Linux+: Your Questions Answered.” CompTIA. ↑
  3. 3.CompTIA. “Linux+ XK0-006 (V8) Exam Objectives.” CompTIA. ↑
  4. 4.Pearson VUE. “CompTIA exam scheduling.” Pearson VUE. ↑
  5. 5.Career Employer. “Linux+ practice-test performance data.” careeremployer.com, updated daily, CC BY 4.0. ↑
Career Employer

Career Employer is the ultimate resource to help you get started working the job of your dreams. We cover topics from general career information, career searching, exam preparation with free study materials, career interviewing, and becoming successful in your career of choice.

Follow Us:

All Posts

Career Employer’s Editorial Process

Here at Career Employer, we focus a lot on providing factually accurate information that is always up to date. We strive to provide correct information using strict editorial processes, article editing, and fact-checking for all of the information found on our website. We only utilize trustworthy and relevant resources. To find out more, make sure to read our full editorial process page here.