ubuntu控制systemd系统和服务的命令
时间: 2023-11-27 16:51:56 浏览: 45
以下是在Ubuntu上控制systemd系统和服务的常见命令:
1. 启动/停止/重启systemd服务:
```
sudo systemctl start servicename
sudo systemctl stop servicename
sudo systemctl restart servicename
```
2. 禁用/启用systemd服务:
```
sudo systemctl disable servicename
sudo systemctl enable servicename
```
3. 查看systemd服务状态:
```
sudo systemctl status servicename
```
4. 查看systemd服务日志:
```
sudo journalctl -u servicename
```
5. 查看所有systemd服务的状态:
```
sudo systemctl list-units --type=service
```
6. 查看所有已启动的systemd服务:
```
sudo systemctl list-units --type=service --state=running
```
7. 查看所有已禁用的systemd服务:
```
sudo systemctl list-unit-files --type=service --state=disabled
```
8. 查看当前运行的systemd版本:
```
systemctl --version
```
以上是一些常用的命令,如果想深入了解systemd,可以参考其官方文档。