https://blog.csdn.net/weixin_38407447/article/details/90581454#t36
5.4 防火墙
1)基本语法:
service iptables status (功能描述:查看防火墙状态)
chkconfig iptables –list (功能描述:查看防火墙开机启动状态)(双横线)
service iptables stop (功能描述:临时关闭防火墙)
chkconfig iptables off (功能描述:关闭防火墙开机启动)
chkconfig iptables on (功能描述:开启防火墙开机启动)
2)扩展
Linux系统有7个运行级别(runlevel)
运行级别0:系统停机状态,系统默认运行级别不能设为0,否则不能正常启动
运行级别1:单用户工作状态,root权限,用于系统维护,禁止远程登陆
运行级别2:多用户状态(没有NFS)
运行级别3:完全的多用户状态(有NFS),登陆后进入控制台命令行模式
运行级别4:系统未使用,保留
运行级别5:X11控制台,登陆后进入图形GUI模式
运行级别6:系统正常关闭并重启,默认运行级别不能设为6,否则不能正常启动
5.5 关机重启
在linux领域内大多用在服务器上,很少遇到关机的操作。毕竟服务器上跑一个服务是永无止境的,除非特殊情况下,不得已才会关机 。
正确的关机流程为:sync > shutdown > reboot > halt
1)基本语法:
(1)sync (功能描述:将数据由内存同步到硬盘中)
(2)shutdown [选项] 时间
选项:
-h:关机
-r:重启
(3)halt (功能描述:关闭系统,等同于shutdown –h now 和 poweroff)
(4)reboot (功能描述:就是重启,等同于 shutdown –r now)
2)案例
(1)将数据由内存同步到硬盘中
[root@hadoop102 /]#sync
(2)计算机将在10分钟后关机,并且会显示在登录用户的当前屏幕中
[root@hadoop102 /]#shutdown –h 10 ‘This server will shutdown after 10 mins’
(3)立马关机
[root@hadoop102 /]# shutdown –h now
(4)系统立马重启
[root@hadoop102 /]# shutdown –r now
(5)重启(等同于 shutdown –r now)
[root@hadoop102 /]# reboot
(6)关机(等同于shutdown –h now 和 poweroff)
[root@hadoop102 /]#halt