阅读量:102
在Linux系统中,可以使用systemd作为服务管理器来管理服务。以下是一些常用的命令来管理服务:
- 启动服务:
sudo systemctl start - 停止服务:
sudo systemctl stop - 重启服务:
sudo systemctl restart - 查看服务状态:
sudo systemctl status - 开机自启动:
sudo systemctl enable - 禁止开机自启动:
sudo systemctl disable - 查看所有已启动的服务:
systemctl list-units --type=service - 查看所有已启用的服务:
systemctl list-unit-files --type=service - 查看所有服务的状态:
systemctl list-units --type=service --all
除了systemd之外,也可以使用其他工具如SysVinit或Upstart来管理服务,但systemd是目前较为常用的服务管理器。