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.
Which systemd command displays a list of all loaded services, including their current status, on a running Linux system?
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.
Where does systemd primarily look for system-wide unit configuration files when managing services?
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.
If an administrator wants a custom web service to start automatically at boot, which systemctl command should they use?
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.
Which command allows administrators to create and start a one-time, ephemeral service without writing a unit file to disk?
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.
What is the correct systemd command to view recent logs for a failed service named dbsync.service for troubleshooting?
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.