admin管理员组文章数量:1586727
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课程文档,如有侵权联系删
版权声明:本文标题:Linux服务器操作常用命令 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1727988431a1141335.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论