I want to get a list of active and not-found systemd (user) units.
$ systemctl --user list-units --state=not-found
UNIT LOAD ACTIVE SUB DESCRIPTION
● server.service not-found active running server.service
● pipewire-media-session.service not-found inactive dead pipewire-media-session.service
...
This lists both active and inactive units. As systemctl's manual, you can combine them as --state=not-found,active
, but acts like an OR filter, not AND.
I guess I can just grep the previous output, but I want to ask if I can do this with just systemctl
.
systemctl is-enabled UNIT
is something you might want to use, checkman systemctl
for its return values. Otherwise you need to usegrep
.