欢迎访问 SJsir 圣杰博客

A Linux operation and maintenance engineer's Blogs

Systemctl命令实例

显示所有单元状态:                  systemctl
只显示服务单元的状态:              systemctl --type=service
显示sshd 服务单元:                systemctl status sshd.service –l
验证sshd 服务当前是否活动:         systemctl is-active sshd
启动,停止和重启sshd 服务:
                                  systemctl start sshd.service
                                  systemctl stop sshd.service
                                  systemctl restart sshd.service
重新加载配置:                      systemctl reload sshd.service
列出活动状态的所有服务单元:         systemctl list-units --type=service
列出所有服务单元:                  systemctl list-units --type=service --all
查看服务单元的启用和禁用状态:       systemctl list-unit-files --type=service
列出失败的服务:                    systemctl --failed --type=service
列出依赖的单元:                    systemctl list-dependencies sshd
验证sshd 服务是否开机启动:          systemctl is-enabled sshd
禁用network ,使之不能自动启动, 但手动可以: systemclt disable network
启用network:                       systemctl enable network
禁用network ,使之不能手动或自动启动:systemclt mask network
启用network:                       systemctl umask network
点赞