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高性能優化的幾個關鍵點
相關內容:
