通过端口号查找占用程序
1.查看占用端口号的进程
netstat -anpl|grep 8161
2.54703就是PID,再通过PID查找程序
ps -aux|grep 54703
这里可以看到应用程序的目录,有activemq关键字,于是就是这个应用占用了
通过程序查找占用端口号
1.通过应用程序查看PID
ps -aux|grep activemq
2.可以看到PID是54703,再通过PID查看占用端口
netstat -anop|grep 54703
被红色框起来的就是被占用的端口