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课程文档,如有侵权联系删

  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值