centos7配置常用命令

安裝netstat插件 yum install net-tools
安裝killall插件 yum install psmisc


查看ip:
 ip addr 192.168.1.111

查看所有端口  netstat -ano ( netstat -tunlp)
開啓端口 
 firewall-cmd --zone=public --add-port=80/tcp --permanent 
 命令含義: 
 --zone #作用域 
 --add-port=80/tcp #添加端口,格式爲:端口/通訊協議 
 --permanent #永久生效,沒有此參數重啓後失效 
重啓防火牆 
 firewall-cmd --reload 

查看端口
firewall-cmd --zone=public --query-port=80/tcp --permanent 

關閉firewall:

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service #禁止firewall開機啓動
firewalld啓動:# systemctl start firewalld
查看狀態:# systemctl status firewalld或者firewall-cmd --state
禁用:# systemctl stop firewalld


查看全部服務命令:
systemctl list-unit-files --type service
查看服務
systemctl status name.service
啓動服務
systemctl start name.service
停止服務
systemctl stop name.service
重啓服務
systemctl restart name.service增加開機啓動
systemctl enable name.service
刪除開機啓動
systemctl disable name.service
其中.service 可以省略。


配置開機啓動 

systemctl enable tomcat

啓動tomcat
systemctl start tomcat
停止tomcat
systemctl stop tomcat
重啓tomcat
systemctl restart tomcat

因爲配置pid,在啓動的時候會再



systemctl reboot	重啓機器
systemctl poweroff	關機
systemctl suspend	待機
systemctl hibernate	休眠

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章