[systemd-devel] Regex parsable output of systemctl

Mantas Mikulėnas grawity at gmail.com
Tue Dec 18 09:15:37 UTC 2018


On Tue, Dec 18, 2018 at 11:09 AM Thomas Güttler
<guettliml at thomas-guettler.de> wrote:
>
> Hi,
>
> to get a regex parsable output of systemctl, I use this up to now:
>
>      systemctl list-units --full --all --plain --no-legend
>
> This is a lot of typing.
>
> AFAIK there is no way to make it shorter (maybe use -a instead of --all).
>
> Maybe I am blind and there is already a switch which makes the output
> of systemctl easy to parse in scripts.
>
> If there is no such switch up to now, then it would be very nice if
> it could be added.

Having a JSON output mode for the table would be nice (at least for
DBus-incapable shell scripts). You could then feed that to `jq`.

(I wonder if systemctl could use libsmartcols from util-linux...)


--
Mantas Mikulėnas


More information about the systemd-devel mailing list