列出透過systemd執行中的服務

列出所有「活動中」(running + active)的服務

指令

1
sudo systemctl list-units --type=service --state=running

結果

1
2
3
4
5
6
7
8
  UNIT                     LOAD   ACTIVE SUB     DESCRIPTION
  avahi-daemon.service     loaded active running Avahi mDNS/DNS-SD Stack
  bluetooth.service        loaded active running Bluetooth service
  chrony.service           loaded active running chrony, an NTP client/server
  containerd.service       loaded active running containerd container runtime
  cron.service             loaded active running Regular background program processing daemon
  dbus.service             loaded active running D-Bus System Message Bus
  dnsmasq.service          loaded active running dnsmasq - A lightweight DHCP and caching DNS server

列出所有「已啟動」(running + active + existed)的服務(包含啟動後已結束的)

指令

1
systemctl list-units --type=service --state=active

結果

1
2
3
4
5
  UNIT                                                        LOAD   ACTIVE SUB     DESCRIPTION                                            >
  alsa-restore.service                                        loaded active **exited**  Save/Restore Sound Card State
  avahi-daemon.service                                        loaded active running Avahi mDNS/DNS-SD Stack
  beszel-agent.service                                        loaded active running Beszel Agent Service
  bluetooth.service                                           loaded active running Bluetooth service
Built with Hugo
Theme Stack designed by Jimmy