Linux Survival Basics
Print the Exact systemd Exit Fields
Full status output is useful for humans, but incident notes and scripts need compact fields like Result, ExecMainStatus, and restart count.
Command
systemctl show app-worker --property=Result,ExecMainCode,ExecMainStatus,NRestarts --no-pager
What changed
Nothing changes. systemctl show prints selected unit properties.
Danger
safe
When to use it
Use when documenting a failure, comparing before and after recovery, or writing a runbook check.
When not to use it
Do not treat numeric status values as self-explanatory; pair them with status or journal lines.
Undo or recovery
No undo needed because the command is read-only.
Expected output
Result, ExecMainCode, ExecMainStatus, and NRestarts property lines.
demo script
Disposable terminal steps
systemctl status app-worker --no-pager --lines=50systemctl show app-worker --property=Result,ExecMainCode,ExecMainStatus,NRestarts --no-pager
simulated output
What it looks like
::fixture-ready::
$ systemctl status app-worker --no-pager --lines=50
● app-worker.service - Background job worker
Loaded: loaded (/etc/systemd/system/app-worker.service; enabled; preset: enabled)
Drop-In: /etc/systemd/system/app-worker.service.d
└─override.conf
Active: failed (Result: exit-code) since Thu 2026-06-25 14:22:17 CDT; 4min ago
Duration: 1.243s
Process: 2144 ExecStart=/srv/app/bin/worker --queue default (code=exited, status=217/USER)
Main PID: 2144 (code=exited, status=217/USER)
CPU: 38ms
Jun 25 14:22:17 vps systemd[1]: Started app-worker.service - Background job worker.
Jun 25 14:22:17 vps systemd[2144]: app-worker.service: Failed to determine user credentials: No such process
Jun 25 14:22:17 vps systemd[2144]: app-worker.service: Failed at step USER spawning /srv/app/bin/worker: No such process
Jun 25 14:22:17 vps systemd[1]: app-worker.service: Main process exited, code=exited, status=217/USER
Jun 25 14:22:17 vps systemd[1]: app-worker.service: Failed with result 'exit-code'.
::exit-code::0
$ systemctl show app-worker --property=Result,ExecMainCode,ExecMainStatus,NRestarts --no-pager
Result=exit-code
ExecMainCode=1
ExecMainStatus=217
NRestarts=5
::exit-code::0
YouTube Short
Print compact failure fields.
For incident notes, ask systemd for the exact failure fields instead of copying a whole status page.
LinkedIn hook
Turn a noisy service failure into four fields you can paste into an incident note.
Question: Which systemd fields do you capture in incident notes?
experiments
A/B tests to run
Metric: short_click_through_rate
A: Turn service failure into four fields.
B: Cleaner incident notes for failed units.