• Linux服务器操作常用命令


    1.service 服务管理(CentOS 6版本-了解)

    1)基本语法 service 服务名

    start | stop | restart | status

    查看网络服务的状态 service network status

    停止网络服务 service network stop

    启动网络服务 service network start 

    重启网络服务 service network restart

    2)chkconfig 设置后台服务的自启动配置(CentOS 6版本)

    chkconfig (功能描述:查看所有服务器自启配置)

    chkconfig 服务名 off (功能描述:关掉指定服务的自动启动)

    chkconfig 服务名 on (功能描述:开启指定服务的自动启动)

    chkconfig 服务名 --list (功能描述:查看服务开机启动状态)

    3)systemctl (CentOS 7版本-重点掌握)

    systemctl start | stop | restart | status 服务名

    使用基本与service相同

    4)systemctl 设置后台服务的自启配置

    systemctl list-unit-files (功能描述:查看服务开机启动状态)

    systemctl disable service_name (功能描述:关掉指定服务的自动启动)

    systemctl enable service_name (功能描述:开启指定服务的自动启动)

    查看当前运行级别: systemctl get-default

    systemctl set-default TARGET.target (这里 TARGET取multi-user或者 graphical)

    TARGET 就是系统运行级别,一般就使用3 5

    5)关机重启命令

    在 linux领域内大多用在服务器上,很少遇到关机的操作。毕竟服务器上跑一个服务是永无止境的,除非特殊情况下,不得已才会关机。

    (1)sync(功能描述:将数据由内存同步到硬盘中)

    (2)halt(功能描述:停机,关闭系统,但不断电)

    (3)poweroff (3)reboot(功能描述:关机,断电)

    (4) shutdown [选项] 时间(功能描述:就是重启,等同于 shutdown -r now)

    选项:

    -H 相当于--halt,停机

    -r -r=reboot 重启

    now 立刻关机

    时间 等待多久后关机(时间单位是分钟)

    参考尚硅谷Linux课程文档,如有侵权联系删

  • 相关阅读:
    【C语言刷题】双指针原地修改数组(力扣原题分析)
    初窥门径代码起手,Go lang1.18入门精炼教程,由白丁入鸿儒,首次运行golang程序EP01
    Python 进程和线程详解(multiprocessing、threading)
    七夕节最深情表白文案从此告别搓衣板
    vuex--共享状态(数据)管理
    Mysql JDBC反序列化漏洞
    像追女神一样学好java~
    Python3,区区一段代码,自己就可以制作动漫头像,YYDS。
    MQ - 22 Kafka集群架构设计与实现
    在服务器导出kafka topic数据
  • 原文地址:https://blog.csdn.net/qq_51260764/article/details/126364136