Appearance
systemctl
Unit/Service Commands
systemctl start <unit>:启动指定的单元。systemctl stop <unit>:停止指定的单元。systemctl restart <unit>:重新启动指定的单元。systemctl status <unit>:显示指定单元的状态信息。systemctl enable <unit>:设置指定单元开机自启动。systemctl disable <unit>:禁用指定单元开机自启动。
Unit/Service File Commands
systemctl edit <unit>:编辑指定单元的配置文件。systemctl cat <unit>:显示指定单元的配置文件内容。systemctl list-unit-files:列出所有已安装的单元文件及其状态。systemctl daemon-reload:重新加载 Systemd 管理器配置,以使新的或更改过
Examples
列出正在运行的服务
bash
systemctl list-units --type=service --state=running上面 systemctl daemon-reload 命令比较重要,当我们修改配置文件后很容易忘记reload
