linux 进程和端口互查

1.根据进程名查看端口:

a.先获取进程号即pid

ps -ef|grep Name

b.用netstat获取端口号

netstat -nap|grep pid

2.根据端口号查询进程名:

有两种方法:

a: lsof -i:端口号

b. netstat -tunlp|grep 端口号

原文地址:https://www.cnblogs.com/linwenbin/p/11107027.html