Windows上
查看端口占用:
netstat -aon|findstr <端口号>
通过进程ID查询进程信息
tasklist | findstr <上一步查出来的进程号>
图例:
Linux 上
查看端口占用:
netstat -tuln | grep <端口号>
lsof -i:<端口号>
ss -tlnp | grep <端口号>
多种方式,但前提是要安装了相应工具,如: sudo apt-get install netstat