Linux防火墙命令
1.启动防火墙
systemctl start firewalld
2.禁用防火墙
systemctl stop firewalld
3.设置开机启动
systemctl enable firewalld
4.停止并禁用开机启动
sytemctl disable firewalld
5.重启防火墙
firewall-cmd --reload
6.查看状态
systemctl status firewalld
Linux关机重启命令
1.shutdown命令
shutdown命令是一种安全关闭Linux操作系统的命令,Linux系统与Windows系统不同,Linux在后台运行很多线程,强制关机会导致线程数据丢失,甚至有直接关机有可能损坏硬件的风险。
shutdown命令语法:shutdown [选项] [时间] [警告信息]
选项说明:
-r:关机后立即重新启动
-h:关机后不重新启动
-c:取消一个已经运行的shutdown[-time]:设定关机前的时间
......
示例:
立即关闭系统:
shutdown -h now
立即重启系统:
shutdown -r now
定时45分钟后关闭系统:
shutdown -h 45
重新启动系统,并发出警告信息:
shutdown –r now “system will be reboot now!”
2.halt命令(不断电,内存中可能存在数据)
halt命令是调用shutdown -h
命令执行的。
3.reboot命令
reboot工作过程与halt差不多,不同之处在于reboot是引发主机重启,halt是引发主机关机。
reboot
命令立即重启,效果等同于shutdown -r now
4.init命令
init是所有进程的祖先,init进程号始终为1,所以发送TREM信号给init会终止所有的用户进程和守护进程等(shutdown就是使用这种机制)。init定义了7个运行级别,其中init0为关机,init为重启。
5.poweroff命令(断电)
poweroff表示立即关机,效果等同于shutdown -h now