How to see enabled services that have been stopped [systemd]

Someone tell me if there is a better way to do this, but I don’t see how.

I needed a way to see which services I have enabled that I have manually stopped.

There oddly isn’t a way to do this in one command, so I had to take the output of list-unit-files ‘enabled’, and use that to filter for ‘list-units’. The command is here:

alias sysstop=‘systemctl list-units --state=failed,dead,exited $( systemctl list-unit-files --state=enabled --type=service | awk “/.*.service/ {print }” )’

So now I can remember that I need to restart mariadb and nginx at some point:


<span style="color:#323232;">$ sysstop
</span><span style="color:#323232;">  UNIT                                 LOAD   ACTIVE   SUB    DESCRIPTION                                             
</span><span style="color:#323232;">  blueman-mechanism.service            loaded inactive dead   Bluetooth management mechanism
</span><span style="color:#323232;">  mariadb.service                      loaded inactive dead   MariaDB 11.2.2 database server
</span><span style="color:#323232;">  NetworkManager-wait-online.service   loaded active   exited Network Manager Wait Online
</span><span style="color:#323232;">  nginx.service                        loaded inactive dead   A high performance web server and a reverse proxy server
</span><span style="color:#323232;">  systemd-homed-activate.service       loaded active   exited Home Area Activation
</span><span style="color:#323232;">  systemd-networkd-wait-online.service loaded active   exited Wait for Network to be Configured
</span>

My other aliases are here, in case anyone finds these helpful. I use them frequently myself.


<span style="color:#323232;">alias sysdis='systemctl list-unit-files --type=service --state=disabled'
</span><span style="color:#323232;">alias sysdisuser='systemctl list-unit-files --type=service --state=disabled --user'
</span><span style="color:#323232;">alias sysen='systemctl list-unit-files --type=service --state=enabled'
</span><span style="color:#323232;">alias sysenuser='systemctl list-unit-files --type=service --state=enabled --user'
</span><span style="color:#323232;">alias sysfail='systemctl list-units --type=service --state=failed'
</span><span style="color:#323232;">alias sysrun='systemctl list-units --type=service --state=running'
</span><span style="color:#323232;">alias sysrunuser='systemctl list-units --type=service --state=running --user'
</span><span style="color:#323232;">alias sysstatic='systemctl list-units --type=service --state=static'
</span>
BaroqueInMind,
BaroqueInMind avatar

systemctl status | grep stopped

luthis,

I think you’re thinking of

systemctl list-units --type=service --state=stopped

status gives the state of the system and a cgroup tree

SaltyIceteaMaker,

Can’t you do systemctl status [service] to check that?

ISometimesAdmin,
@ISometimesAdmin@the.coolest.zone avatar

That's only for a single service, not really what OP seems to be asking for

luthis,

Only if you know what the [service] is. In my case, I’m prone to forgetting so this way I can see what should be running but isn’t

cows_are_underrated,

Don’t you start a service with system tl servicename?

luthis,

Yes,

systemctl start [servicename]

But I wanted to see what I have stopped and not started again

cows_are_underrated,

OK, that’s nothing I can help you with.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • khanakhh
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • osvaldo12
  • ethstaker
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • everett
  • ngwrru68w68
  • kavyap
  • InstantRegret
  • megavids
  • GTA5RPClips
  • Durango
  • normalnudes
  • cubers
  • tacticalgear
  • cisconetworking
  • tester
  • modclub
  • provamag3
  • anitta
  • Leos
  • JUstTest
  • lostlight
  • All magazines