systemctl 命令

系统环境

基于腾讯云服务器,系统是Ubuntu 学习
uname -a
lsb_release -a 

image-pyfk.png

基本介绍

systemctl是 systemd 的主命令,用于管理系统。
systemctl 指令管理的服务在 /usr/lib/systemd/system

cd /usr/lib/systemd/system
ls -a

image-vpre.png

语法格式

systemctl [OPTIONS...] COMMAND ...

常用的命令(下面以docker为例 )

启动服务
 systemctl start docker.socket
查看启动状态
 systemctl status docker.socket
停止服务
 systemctl stop docker.socket
查看开启服务
 systemctl is-enabled docker.socket
查看服务活动
 systemctl is-active docker.socket
 ...

image-kzwv.png

查看支持帮助

systemctl -h

image-twvk.png