linux中systemctl详细理解及常用命令

一、systemctl理解

Linux 服务管理两种方式service和systemctl

systemd是Linux系统最新的初始化系统(init),作用是提高系统的启动速度,尽可能启动较少的进程,尽可能更多进程并发启动。

systemd对应的进程管理命令是systemctl

1. systemctl命令兼容了service

即systemctl也会去/etc/init.d目录下,查看,执行相关程序

systemctl redis start 
systemctl redis stop 
# 开机自启动 
systemctl enable redis

2.常见命令

foobar表示伪变量。

打开服务:sudo systemctl start foobar
关闭服务:sudo systemctl stop foobar
重启服务:sudo systemctl restart foobar
不中断正常功能下重新加载服务:sudo systemctl reload foobar
设置服务的开机自启动:sudo systemctl enable foobar
关闭服务的开机自启动:sudo systemctl disable foobar
查看活跃的单元:systemctl list-units
查看某个服务的状态:systemctl status foobar
查看已启动的服务列表: systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed

参考链接:技术|systemctl 命令完全指南

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值