Linux系统命令:重启、关机、防火墙、进程、服务
作者:管理员 来源:互联网 发布时间:2025-11-13 10:10:20 点击数:0
linux分为3类
1、Redhat系,主要有Redhat、Centos、Fedora等,其中Centos系统是很多服务器用户选择的系统;
2、Debian系,主要有Debian、Ubuntu、Mint等,这个系还有其他一些衍生版本的系统;
3、其他系统,例如Gentoo、Arch Linux、LFS等。
重启系统
reboot #直接重启; shutdown -r now #立刻重启(仅限root用户) shutdown -r 10 #10分钟后重启(仅限root用户) shutdown -r 20:35 #在指定时间重启(仅限root用户)
关机
Halt #立刻关机 Poweroff #强制立刻关机 Shutdown -h now #立刻关机(仅限root用户) Shutdown -r 10 #10分钟后关机
关闭/开启 防火墙
chkconfig iptables off #永久关闭,重启后不会复原;开启防火墙:chkconfig iptables on service iptables stop #暂时关闭,重启后复原; 开启防火墙:service iptables start systemctl start firewalld #centos7开启防火墙 systemctl stop firewalld #centos7关闭防火墙 systemctl status firewalld #centos7查看防火墙状态 systemctl disable firewalld #centos7开机禁用防火墙 systemctl enable firewalld #centos7开机起用防火墙 # 注意,生产环境只能放开某个端口,不能直接禁用防火墙;在开启防火墙的状态下,执行如下命令,放开9200端口: firewall-cmd --zone=public --add-port=9200/tcp --permanent
查看进程
比如查看redis进程,可以使用
# 根据名字查看对应的进程 ps aux|grep redis # 根据端口号查看进程号 netstat -lntp|grep 8080
服务相关
service --status-all #显示系统所有的后台进程 service network status #查看指定服务进程(查看mysql进程:service mysql status) service network start #手动开启指定服务 service network stop #停止指定服务的进程 service network restart #重启指定服务进程
上一篇:Debian12怎么升级补丁更新系统?
下一篇:Nginx高性能优化的几个关键点
相关内容:
