I am not happy with the output of systemctl
I have a script which parses the output of
systemctl list-units -t service --full --all
The beginning of the output look like this:
UNIT LOAD ACTIVE SUB JOB DESCRIPTION
after-local.service loaded inactive dead /etc/init.d/after.local Compatibility
● amavis.service not-found inactive dead amavis.service
apparmor.service loaded active exited Load AppArmor profiles
auditd.service loaded active running Security Auditing Service
On a different systemd the column with the dot (before amavis.service) does not exist.
Is there a machine/script readable output of systemctl?
I use this for machine-parsable output, adding
--plain --no-legend
, for example:you can get json (or
json-pretty
) output by setting the--output
flag:if your version of systemctl is without json output support, you can get json like so: