About this article
This article was created using an automated generation flow utilizing generative AI. We reviewed the specifications of systemd and organized it so that the human-orientedsystemctl statusand the machine-orientedsystemctl showcan be compared for the same service. Verification status: 📘 Official systemd specification checked, actual Ubuntu device not checked.
While systemctl status is convenient for humans to read, if you want to determine the status using a script or automated program, the property output of systemctl show is much easier to handle. First, let’s compare both commands for the same service.
Basic comparison: status vs show
The first command provides a human-oriented display including log fragments, whereas the second is narrowed down to machine-readable format values.
systemctl status nginx --no-pager systemctl show nginx -p ActiveState -p SubState -p MainPID
In systemctl show, values are returned in a key=value format, making it straightforward to parse in shell scripts or other programming languages.
Expected output properties
When you run the systemctl show command, you will get independent property lines as shown below. Note that PIDs will vary depending on your environment.
ActiveState=active SubState=running MainPID=1234
Checking execution status and exit codes
You can also check other specific properties such as ExecMainStatus instead of just MainPID to inspect the exit status of the most recent main process.
systemctl show nginx -p ActiveState -p ExecMainStatus
This demonstrates that "whether a service is currently running" and "the exit status of its most recent process" evaluate different perspectives of service lifecycle management.
Practical use cases in operations
In system monitoring, pre-backup checks, and post-deployment validation, explicitly retrieving necessary properties makes your processing intent much clearer compared to grepping the output text of systemctl status. However, service-specific health cannot be guaranteed by the systemd state alone; always combine it with application-layer checks such as HTTP health-check endpoints for web applications.
Official Information / Primary Sources
この記事の更新履歴
この記事は、生成AIを活用した自動レビュー・更新フローにより内容を見直し、必要な修正を反映しています。
2026年9月24日
- 変更途切れていた冒頭の引用部分および導入文を修正し、人間向けのsystemctl statusと機械処理向けのsystemctl showの違いを明確に記述しました。
- 変更見出しの文字列が不自然に分断されていた箇所を修正し、読みやすい構造に変更しました。

