Linux系統(tǒng)命令:重啟、關(guān)機、防火墻、進程、服務(wù)
作者:管理員 來源:互聯(lián)網(wǎng) 發(fā)布時間:2025-11-13 10:10:20 點擊數(shù):0
linux分為3類
1、Redhat系,主要有Redhat、Centos、Fedora等,其中Centos系統(tǒng)是很多服務(wù)器用戶選擇的系統(tǒng);
2、Debian系,主要有Debian、Ubuntu、Mint等,這個系還有其他一些衍生版本的系統(tǒng);
3、其他系統(tǒng),例如Gentoo、Arch Linux、LFS等。
重啟系統(tǒng)
reboot #直接重啟; shutdown -r now #立刻重啟(僅限r(nóng)oot用戶) shutdown -r 10 #10分鐘后重啟(僅限r(nóng)oot用戶) shutdown -r 20:35 #在指定時間重啟(僅限r(nóng)oot用戶)
關(guān)機
Halt #立刻關(guān)機 Poweroff #強制立刻關(guān)機 Shutdown -h now #立刻關(guān)機(僅限r(nóng)oot用戶) Shutdown -r 10 #10分鐘后關(guān)機
關(guān)閉/開啟 防火墻
chkconfig iptables off #永久關(guān)閉,重啟后不會復(fù)原;開啟防火墻:chkconfig iptables on service iptables stop #暫時關(guān)閉,重啟后復(fù)原; 開啟防火墻:service iptables start systemctl start firewalld #centos7開啟防火墻 systemctl stop firewalld #centos7關(guān)閉防火墻 systemctl status firewalld #centos7查看防火墻狀態(tài) systemctl disable firewalld #centos7開機禁用防火墻 systemctl enable firewalld #centos7開機起用防火墻 # 注意,生產(chǎn)環(huán)境只能放開某個端口,不能直接禁用防火墻;在開啟防火墻的狀態(tài)下,執(zhí)行如下命令,放開9200端口: firewall-cmd --zone=public --add-port=9200/tcp --permanent
查看進程
比如查看redis進程,可以使用
# 根據(jù)名字查看對應(yīng)的進程 ps aux|grep redis # 根據(jù)端口號查看進程號 netstat -lntp|grep 8080
服務(wù)相關(guān)
service --status-all #顯示系統(tǒng)所有的后臺進程 service network status #查看指定服務(wù)進程(查看mysql進程:service mysql status) service network start #手動開啟指定服務(wù) service network stop #停止指定服務(wù)的進程 service network restart #重啟指定服務(wù)進程
上一篇:Debian12怎么升級補丁更新系統(tǒng)?
下一篇:Nginx高性能優(yōu)化的幾個關(guān)鍵點
相關(guān)內(nèi)容:
