Linux下端口号关闭与打开

开启端口号:

/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT

查看:lsof -i:8080

netstat -tunlp | grep 8080

netstat -ano | grep 8080

 关闭端口号:

sudo kill -9 PID

注:lsof -i:80时,显示-bash:lsof未找到命令。是因为没有安装lsof。

执行下命令:yum install -y lsof

猜你喜欢

转载自www.cnblogs.com/devin-sl/p/12060163.html