systemctl 是一个用于检视和控制 systemd 系统和服务管理器的命令行工具。systemd 是用于启动、停止和管理 Linux 系统中的服务的守护进程。以下是一些常用的 systemctl 命令及其说明:
-
systemctl start <unit>: 启动指定的服务单元systemctl start sshd -
systemctl stop <unit>: 停止指定的服务单元systemctl stop sshd -
systemctl restart <unit>: 重新启动指定的服务单元systemctl restart sshd -
systemctl status <unit>: 显示指定服务单元的当前状态信息systemctl status sshd -
systemctl enable <unit>: 将指定的服务单元设置为在系统启动时自动启用systemctl enable sshd -
systemctl disable <unit>: 将指定的服务单元设置为在系统启动时自动禁用systemctl disable sshd -
systemctl is-active <unit>: 检查指定的服务单元是否处于活动状态(运行中)systemctl is-active sshd -
systemctl is-enabled <unit>: 检查指定的服务单元是否已启用(开机自启)systemctl is-enabled sshd -
systemctl daemon-reload: 重新加载systemd管理的服务单元,以便识别最新的配置更改systemctl daemon-reload
这些命令提供了对 systemd 系统和服务的广泛管理功能。你可以使用 man systemctl 命令查看 systemctl 命令的手册页面,获取更详细的信息。










