Linux下查看端口号占用情况命令

netstat -ntlp

结果:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      6960/php-fpm: maste
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      20092/nginx: master

如果要杀死Nginx的进程

kill 20092

Centos 7好像没有安装`netstat’,可以使用命令安装工具

yum install net-toolstools