显示所有单元状态
systemctl 或 systemctl list-units
只显示服务单元的状态
systemctl --type=service
显示sshd服务单元
systemctl –l status sshd.service
验证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,使之不能自动启动,但手动
systemd 常用命令
最新推荐文章于 2025-10-24 20:08:04 发布
本文详细介绍了systemd常用命令的使用,包括查看服务状态、启动、停止、重启服务,配置重载,检查服务启用状态,管理服务的开机启动,以及切换系统运行级别等操作。此外,还涵盖了systemd的依赖管理和不同模式的切换。

最低0.47元/天 解锁文章
3435

被折叠的 条评论
为什么被折叠?



