systemctl命令列出所有服务
systemctl是Systemd 的主命令,可用于管理系统。
列出所有已经加载的systemd units
systemctl
systemctl | grep docker.service
1
2
列出所有service
systemctl list-units --type=service
systemctl --type=service
1
2
列出所有active状态(运行或退出)的服务
systemctl list-units --type=service --state=active
1
列出所有正在运行的服务
systemctl list-units --type=service --state=running
1
列出所有正在运行或failed状态的服务
systemctl list-units --type service --state running,failed
1
列出所有enabled状态的服务
systemctl list-unit-files --state=enabled
查看所有开机启动项
sudo systemctl list-unit-files
- 1
筛选enabled状态的开机项目
sudo systemctl list-unit-files | grep enabled