[英]Application path and listening port
I'd like to know which application that is listening on a port on a linux machine. 我想知道哪个应用程序正在侦听linux机器上的端口。
There are multiple servers, apache and what not on a single machine and I'd like to know which server is listening on which port without having to dig through the configuration files of each server. 有多个服务器,apache和什么不在一台机器上,我想知道哪个服务器正在监听哪个端口而不必挖掘每个服务器的配置文件。
Is there a command that lists the path to the executable and which port it is listening on? 是否有一个命令列出可执行文件的路径以及它正在侦听的端口?
netstat -t -l -p
will list the listening ports and the pid and process name that created the socket. netstat -t -l -p
将列出监听端口以及创建套接字的pid和进程名称。 Since you have the pid you can use ps PID
to find the path to the executable. 由于您有pid,因此可以使用
ps PID
查找可执行文件的路径。
另外lsof -i:<port number>
应该为您提供进程的PID,您可以使用ps <pid>
来查找路径
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.