Linux常用服务类相关命令

Centos 6

1. 常用命令

1
2
service 服务名 start | stop | restart | reload | status
例:查看网卡状态: service network status

2. 设置自启动

  • 查看服务是否自启

    1
    chkconfig --list | grep 服务名
  • 设置自启动 ( on – 开启, off – 关闭)

    1
    chkconfig --level 5 服务名 on

Centos 7

1. 常用命令

1
2
sysremctl start | stop | restart | reload | status 服务名
例:查看防火墙状态: systemctl status firewall

2. 查看服务

  • 方法:/usr/lib/systemd/system

  • 命令:

    list-unit-files```
    1
    2

    ```systemmctl --type service

3.设置服务自启动 (enable : 启动, disable: 关闭)

1
systemctl enable 服务名

感谢阅读本博客。

欢迎关注我的博客:https://li-weijian.github.io/

欢迎关注我的CSDN:https://blog.csdn.net/qq352642663

需要联系请加QQ:352642663

欢迎联系我共同交流