start: 启动一个服务:
sudo systemctl start servicename.service
stop: 停止一个服务:
sudo systemctl stop servicename.service
reload: 重启一个服务:
sudo systemctl restart servicename.service
reload: 重新加载一个服务的配置:
sudo systemctl reload servicename.service
status: 查看一个服务的状态
sudo systemctl status servicename.service
enable: 设置一个服务开机自启动
sudo systemctl enable servicename.service
disable: 取消一个服务的开机自启动
sudo systemctl disable servicename.service
is-active: 检查一个服务是否正在运行
udo systemctl is-active servicename.service
is-enabled: 检查一个服务是否设置为开机自启动
sudo systemctl is-enabled servicename.service
list-units: 列出当前加载的所有单位(包括服务、套接字、设备等)
systemctl list-units
以上加入systemctl运行时可以直接省去.service