Linux Systemd u0026 Service Management Quiz Quiz

Challenge your understanding of Linux systemd basics, service lifecycle management, and common administrative tasks. This quiz helps users review essential commands, configuration files, and troubleshooting procedures for effective system service control in Linux environments.

  1. Identifying the Correct Command to List Services

    Which systemd command displays a list of all loaded services, including their current status, on a running Linux system?

    1. servicectl --list
    2. systemctl units-services
    3. systemctl list-units --type=service
    4. systemd-analyze blame

    Explanation: The correct command is systemctl list-units --type=service, which shows all loaded services and their statuses. While systemd-analyze blame lists boot times for each service, it does not provide a comprehensive service status overview. The option servicectl --list is a typo and is not recognized by systemd. The command systemctl units-services is incorrect syntax and will result in an error.

  2. Unit Configuration File Location

    Where does systemd primarily look for system-wide unit configuration files when managing services?

    1. /lib/systemd/tasks/
    2. /usr/local/systemd/services/
    3. /etc/systemd/system/
    4. /var/log/systemd/

    Explanation: /etc/systemd/system/ is the main directory used for system-wide unit configuration files, allowing administrators to override or add units. /usr/local/systemd/services/ is not a standard systemd directory and would not be checked by default. /var/log/systemd/ is a logging directory, not for configuration. /lib/systemd/tasks/ is an incorrect path and not referenced by systemd for configuration files.

  3. Service Enablement at Boot

    If an administrator wants a custom web service to start automatically at boot, which systemctl command should they use?

    1. systemctl enable my-web.service
    2. systemctl edit my-web.service
    3. systemctl mask my-web.service
    4. systemctl reload my-web.service

    Explanation: systemctl enable my-web.service creates symlinks so the service starts at boot. The reload command only refreshes a running service's configuration and does not affect boot behavior. Masking a service prevents it from being started at all. Editing a service opens its override file, but does not enable or start it automatically.

  4. Transient Service Creation

    Which command allows administrators to create and start a one-time, ephemeral service without writing a unit file to disk?

    1. servicerun once
    2. systemctl create
    3. systemd-run
    4. systemctl temporary

    Explanation: systemd-run lets administrators run commands as transient services without needing to write unit files. systemctl create is not a valid systemd command. servicerun once is not recognized by systemd and is not a standard Linux command. systemctl temporary does not exist as an option within systemctl.

  5. Diagnosing Service Failures

    What is the correct systemd command to view recent logs for a failed service named dbsync.service for troubleshooting?

    1. systemctl log dbsync.service
    2. journal-read dbsync
    3. logctl dbsync-service
    4. journalctl -u dbsync.service

    Explanation: journalctl -u dbsync.service displays logs specifically for that unit, which is essential for diagnosing failures. systemctl log is not a valid subcommand, so it will return an error. logctl is not a standard Linux or systemd tool. journal-read dbsync is not a correct command within the systemd toolset.