Courseiva
Service Configuration →easyMultiple Select

LFCS Service Configuration Practice Question

Which TWO commands can be used to check whether a systemd service is currently running?

⚠ Common exam trap

Watch out — candidates often confuse 'is-enabled' (boot-time configuration) with 'is-active' (current runtime state), or think that listing all running units (option B) is a valid way to check a specific service, when in fact it requires additional parsing and does not directly answer the question.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

systemctl status service

Option A, `systemctl status service`, is correct because it queries the service's runtime state and displays the Active line (e.g., `Active: active (running)`), directly showing whether the unit is currently running. Option C, `systemctl is-active service`, is correct because it prints the unit's active state (typically `active` or `inactive`) and returns exit code 0 when the service is running, making it ideal for scripted checks. Option B, `systemctl list-units --state=running`, lists all running units system-wide rather than confirming one specific service, so it is not a targeted check. Option D, `systemctl is-enabled service`, only reports whether the unit is enabled to start at boot, not whether it is currently running. Option E, `systemctl show service`, dumps all unit properties by default and does not by itself answer the running-state question without filtering for ActiveState.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    systemctl status service

    Why this is correct

    'systemctl status' queries the unit's runtime state and prints Active: active (running) or inactive (dead), along with the main PID and recent log lines. This directly reports whether the service is currently running, satisfying the check required by the stem.

  • ✗

    systemctl list-units --state=running

    Why it's wrong here

    list-units --state=running enumerates every active unit type, including mounts, sockets and timers, so it cannot confirm a specific service is running. It is tempting because it reports runtime state, and would be correct when auditing which units of any kind are currently active on the host.

  • ✓

    systemctl is-active service

    Why this is correct

    'systemctl is-active' returns the unit's active state as a single word, exiting 0 for active and non-zero otherwise. That exit code makes it ideal for scripts verifying whether the service is currently running, matching the stem's requirement.

  • ✗

    systemctl is-enabled service

    Why it's wrong here

    is-enabled reports whether a unit is configured to start at boot, reading the unit file's installation state rather than its current runtime state, so an enabled service may be stopped. It is tempting because it queries systemd about a named service, and would be correct when verifying persistence across reboots.

  • ✗

    systemctl show service

    Why it's wrong here

    show dumps all properties of a unit, including ActiveState, but returns success even for inactive or failed units, so it does not itself answer whether the service is running. It is tempting because it inspects a named unit, and would be correct when troubleshooting detailed property values.

About these practice questions

Courseiva writes every LFCS question from scratch — 406 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This LFCS practice question is part of Courseiva's free Linux Foundation certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LFCS exam.