[英]Find the port number of a specific process by using the PID
I am a newbee in this.我是这方面的新手。 I am using Netstat to find the port number of a specific PID.
我正在使用 Netstat 查找特定 PID 的端口号。 I have used the following comman to find the PIDs of all the process.
我使用以下命令来查找所有进程的 PID。 My goal is to search for the port number only by using the PID of a process.I am using Linux, certain options like find , findstr is not working, so I tried the Following commands.
我的目标是仅使用进程的 PID 搜索端口号。我使用的是 Linux,某些选项如find , findstr不起作用,所以我尝试了以下命令。 Kindly give some suggestion.
请给一些建议。 Thanks in advance
提前致谢
netstat -anop
To show the port number I have used the following code by PID为了显示端口号,我通过 PID 使用了以下代码
sudo netstat -anpe | grep ${#PID}
The port number is shown after the local or foreign address, is the number followed by the semicolumn, ie :端口号显示在本地或外部地址之后,是数字后跟分号,即:
192.168.43.6:42010 198.252.206.25:443
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.