Linux关闭端口的方法

1 查看要关闭的端口号

netstat -anp |grep 端口

#若是不清楚端口号,只知道占用端口的服务,可以

netstat -anp |grep 服务名称

#或者
lsof -i:端口

2 命令关闭

kill -9 PID   #彻底杀死进程