Which command shows the status of a systemd service?

Prepare for the Google Data Center Technician Exam. Use our interactive quiz featuring flashcards and multiple choice questions with hints and explanations. Get exam-ready today!

Multiple Choice

Which command shows the status of a systemd service?

Explanation:
Querying a systemd unit’s state is done with the status command of systemctl. Running systemctl status <service> provides a current snapshot of the unit’s state—whether it is active (running), inactive, or failed—along with whether it is enabled to start at boot, the main process ID, and a small portion of recent journal entries for that service. This gives you both the exact status and a quick view of recent activity in one place. The other options don’t fit as the primary way to show status: viewing logs with journalctl -u <service> shows the service’s logs rather than its real-time state; starting a service with systemctl start <service> executes the service but doesn’t report its status; and the legacy service <service> status can work on some systems but isn’t the standard, systemd-centric way to query a unit’s state.

Querying a systemd unit’s state is done with the status command of systemctl. Running systemctl status provides a current snapshot of the unit’s state—whether it is active (running), inactive, or failed—along with whether it is enabled to start at boot, the main process ID, and a small portion of recent journal entries for that service. This gives you both the exact status and a quick view of recent activity in one place.

The other options don’t fit as the primary way to show status: viewing logs with journalctl -u shows the service’s logs rather than its real-time state; starting a service with systemctl start executes the service but doesn’t report its status; and the legacy service status can work on some systems but isn’t the standard, systemd-centric way to query a unit’s state.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy