CertGrid
Linux Certification

CompTIA Linux+ (XK0-006) Practice Exam

The current CompTIA Linux+ (V8) exam. Covers system management, services and user management, security, automation/orchestration/scripting, and troubleshooting - including containers, Ansible, and responsible AI use.

Start with a free XK0-006 practice test, then work through 743 exam-style questions with full answer explanations, and take timed mock exams that score like the real thing.

Free account: a fixed set of 20 practice questions for this exam, retryable anytime. Paid access unlocks the full bank and timed mock exams. No credit card required to start.

743
Practice pool
Max 90 qs
Real exam
90 min
Real exam time
720 / 900
Passing score

CertGrid runs a fixed 90-question timed mock, separate from the real exam format above.

Objective-mapped practice, aligned to current exam objectives · Reviewed Oct 2026 · Independent practice platform.

What the CompTIA Linux+ (XK0-006) exam covers

Free XK0-006 practice test questions

A sample of 10 questions with answers and explanations. A free account includes a fixed set of 20 practice questions for this exam, retryable anytime. Paid access unlocks the full 743-question bank.

  1. Question 1System Management

    Which command creates a symbolic link named backup that points to /data/report.txt?

    • Aln /data/report.txt backup
    • Bln -h /data/report.txt backup
    • Clink /data/report.txt backup
    • Dln -s /data/report.txt backupCorrect
    ✓ Correct answer: D

    The -s option tells ln to create a symbolic (soft) link, a small file that stores the pathname of its target. Without -s, ln creates a hard link that shares the target's inode. Symbolic links can cross filesystems and point at directories, unlike hard links.

    Why the other options are wrong
    • AA bare ln with no option creates a hard link, not a symbolic one.
    • BGNU ln has no -h option, so this command fails with an invalid option error and creates no link.
    • CThe link utility creates only hard links and accepts no symlink option.
  2. Question 2System Management

    A disk in /dev/md0 is failing. Which command marks the member /dev/sdc as faulty?

    • Amdadm --remove /dev/md0 /dev/sdc
    • Bmdadm --fail /dev/sdc /dev/md0
    • Cmdadm /dev/md0 --fail /dev/sdcCorrect
    • Dmdadm --detail /dev/md0 /dev/sdc
    ✓ Correct answer: C

    In manage mode the array is named first, followed by --fail and the member device to mark as faulty. Marking a disk failed is the step before removing and replacing it.

    Why the other options are wrong
    • A--remove detaches a member but does not first mark it faulty.
    • BThe array and device are in the wrong order; the array must precede the device being failed.
    • D--detail displays array information and does not fail any device.
  3. Question 3Services and User Management

    On a directory, what does the execute (x) permission by itself allow?

    • AList the file names
    • BDelete the directory
    • CChange its group owner
    • DTraverse into it with cdCorrect
    ✓ Correct answer: D

    On a directory the execute bit grants the right to traverse into it (cd) and access entries by name, such as opening a known file path inside it. Without x you cannot enter the directory even if you can read its listing. Read (r) governs listing names, while write (w) plus x governs creating and deleting entries.

    Why the other options are wrong
    • AListing file names is granted by the read (r) permission on a directory, not by execute.
    • BDeleting the directory requires write permission on the parent directory, not execute on the directory itself.
    • CChanging the group owner requires ownership or root privilege via chgrp, and is unrelated to the execute bit.
  4. Question 4Services and User Management

    Which command uninstalls 'httpd' and removes dependencies no longer needed?

    • Adnf remove httpdCorrect
    • Bdnf delete httpd
    • Crpm -r httpd
    • Ddnf drop httpd
    ✓ Correct answer: A

    dnf remove uninstalls the named package and, by default, also cleans up dependencies that were installed only to satisfy it and are now orphaned. This keeps the system free of leftover unused libraries.

    Why the other options are wrong
    • Bdelete is not a valid dnf subcommand.
    • Crpm erases packages with -e, not -r, and it does not remove unused dependencies.
    • Ddrop is not a valid dnf subcommand.
  5. Question 5Security

    Which command loads a private key into the running SSH agent so its passphrase is cached?

    • Assh-add ~/.ssh/id_ed25519Correct
    • Bssh-keygen ~/.ssh/id_ed25519
    • Cssh-copy-id ~/.ssh/id_ed25519
    • Dssh-agent ~/.ssh/id_ed25519
    ✓ Correct answer: A

    ssh-add loads a private key into the running ssh-agent and caches its passphrase, so later connections do not re-prompt. Given a path it adds that specific key; with no argument it adds the default keys. The agent must already be running via ssh-agent.

    Why the other options are wrong
    • Bssh-keygen creates or manages key files; it does not load them into the agent.
    • Cssh-copy-id installs a public key on a remote server.
    • Dssh-agent starts the agent process but does not itself add keys.
  6. Question 6Security

    Which command prevents interactive login for a service account by setting its shell?

    • Ausermod -L /sbin/nologin svc
    • Busermod -s /sbin/nologin svcCorrect
    • Cusermod -e /sbin/nologin svc
    • Dchsh -l /sbin/nologin svc
    ✓ Correct answer: B

    The -s option changes a user's login shell, and setting it to /sbin/nologin causes any login attempt to be politely refused and terminated. This is the standard way to keep a service account usable by daemons while blocking interactive shells. The account still exists and owns its files.

    Why the other options are wrong
    • A-L locks the password and takes no shell argument, so this command is malformed.
    • C-e sets an account expiration date, not the login shell.
    • Dchsh -l lists available shells rather than assigning one; assignment uses -s.
  7. Question 7Automation, Orchestration, and Scripting

    Which is the modern, preferred syntax for command substitution?

    • A`command`
    • B${command}
    • C&(command)
    • D$(command)Correct
    ✓ Correct answer: D

    $(command) runs the command and substitutes its standard output. It is preferred over backticks because it nests cleanly and is easier to read. The captured output is commonly assigned to a variable, such as now=$(date).

    Why the other options are wrong
    • ABackticks perform command substitution but are legacy syntax that nests poorly and is harder to quote.
    • B${command} is parameter expansion of a variable named command, not command substitution.
    • C&(command) is not valid command substitution syntax in Bash.
  8. Question 8Automation, Orchestration, and Scripting

    In a bash script, how do you make a variable available to child processes?

    • Aunset VAR=value
    • Balias VAR=value
    • Cexport VAR=valueCorrect
    • Dchmod VAR=value
    ✓ Correct answer: C

    export marks a shell variable so it is passed into the environment of child processes the script launches. Without export, the variable stays local to the current shell. This is how scripts pass configuration to commands they call.

    Why the other options are wrong
    • Aunset removes a variable rather than exporting it.
    • Balias defines a command shortcut, not an exported variable.
    • Dchmod changes file permissions and has nothing to do with variables.
  9. Question 9Troubleshooting

    Apache cannot open outbound connections until you flip an SELinux boolean. Which command enables it so the change survives a reboot?

    • Asetsebool httpd_can_network_connect on
    • Bsetsebool -P httpd_can_network_connect onCorrect
    • Csemanage boolean httpd_can_network_connect
    • Dgetsebool -a httpd_can_network_connect
    ✓ Correct answer: B

    setsebool changes a boolean, and the -P (persistent) flag writes it to policy so it is restored on the next boot. Without -P the change applies only to the running system and is lost after a reboot, which is a common troubleshooting trap. httpd_can_network_connect is the boolean that lets Apache initiate outbound network connections.

    Why the other options are wrong
    • Asetsebool without -P changes the value only at runtime, so the fix reverts after a reboot.
    • Csemanage boolean requires -m plus --on/--off to modify a value; as written it does not set the boolean.
    • Dgetsebool -a only lists current boolean values and cannot change them.
  10. Question 10System ManagementSelect all that apply

    The filesystem mounted at /srv (on /dev/sdb1) is full. Which TWO commands help you locate the largest space consumers and then confirm how much free space remains? (Choose TWO)

    • Adu -sh /srv/* | sort -hCorrect
    • Bdf -h /srvCorrect
    • Cfree -h
    • Dblkid /dev/sdb1
    • Efdisk -l /dev/sdb1
    ✓ Correct answer: A, B

    du -sh /srv/* summarizes the size of each item under /srv, and piping to sort -h orders them so the largest consumers appear last. df -h /srv then reports total, used, and available space on that filesystem to confirm the cleanup worked.

    Why the other options are wrong
    • Cfree -h reports memory and swap usage, not disk space.
    • Dblkid reports the content type and metadata such as UUID and LABEL; it shows neither directory sizes nor free space.
    • Efdisk -l lists the partition table and partition sizes, not current space consumption.

Who this CompTIA Linux+ (XK0-006) practice exam is for

This practice set is for anyone preparing for the CompTIA Linux+ (XK0-006) exam - from first-time candidates building a foundation to experienced Linux practitioners doing a final review before test day. If you learn best by working through realistic questions and reading why each answer is right or wrong, it is built for you.

How to use this CompTIA Linux+ (XK0-006) practice exam

  1. Start with the free sample questions above to gauge your current baseline.
  2. Read the full explanation on every question, including why each wrong option is wrong.
  3. Track your weak domains and focus your study where you are losing the most marks.
  4. Once you are scoring consistently well, take a timed, full-length mock exam.
  5. Use your readiness score to decide when you are ready to book the real CompTIA Linux+ (XK0-006) exam.

Related Linux resources

CompTIA Linux+ (XK0-006) practice exam FAQ

How many questions are in the CompTIA Linux+ (XK0-006) practice exam on CertGrid?

CertGrid has 743 practice questions for CompTIA Linux+ (XK0-006), covering 5 exam domains. The real CompTIA Linux+ (XK0-006) exam is Max 90 qs in 90 min. CertGrid's timed mock is a fixed 90 questions.

What is the passing score for CompTIA Linux+ (XK0-006)?

The CompTIA Linux+ (XK0-006) exam passing score is 720 / 900, and you have about 90 min to complete it. CertGrid scores your practice attempts the same way so you know when you are ready.

Are these official CompTIA Linux+ (XK0-006) exam questions?

No. CertGrid is an independent practice platform. We do not provide real or leaked exam questions. Our questions are original and designed to help you practice the concepts, scenarios, and difficulty style of the CompTIA Linux+ (XK0-006) exam.

Is there a free XK0-006 practice test?

Yes. You can take a free CompTIA Linux+ (XK0-006) practice test straight away: a fixed set of 20 practice questions for this exam, retryable as often as you like, with no credit card required. You get readiness scoring and a weak-domain breakdown on those questions. Paid plans unlock the full 743-question bank, timed mock exams and full-bank domain analytics.

What CertGrid is (and is not)

CertGrid is an independent IT certification practice platform for Azure, AWS, Google, Cisco, Security, Linux, Kubernetes, Terraform, and other certification tracks. It provides objective-mapped practice questions, readiness scoring, weak-domain drills, and explanations to help learners understand what to study next.

Independent & original. CertGrid is not affiliated with or endorsed by Microsoft, AWS, Google, Cisco, CompTIA, the Linux Foundation, HashiCorp, or other certification vendors. Questions are original practice items designed to mirror certification concepts and exam style. CertGrid does not provide official exam questions or braindumps.