列出所有enabled, active的service:systemctl list-units --type=service
列出所有service,不论active还是inactive又或者是failed和not-found:systemctl list-units --type=service --all
列出所有已安装的service,不论有没有运行,不论有没有设置为系统启动项,不论服务是否还有效:systemctl list-unit-files --type=service
备注:
一般安装的service file可能会有4中状态:
- enabled 安装了的,并会随系统启动而启动。
- static Enabled服务启动时需要同时启动的依赖服务。
- disabled 已安装,但不可随系统启动而同时启动的服务。
- invalid 无效的