我们知道, 根据ps -aux | grep xxx就是很快实现进程名和进程号的互查, 所以我们只说进程号pid就行。 如下示例中, 进程pid常驻。

1.根据进程pid查端口

  lsof -i | grep pid

 

2.根据端口port查进程(某次面试还考过)

  lsof -i:port

 

3.根据进程pid查端口

  netstat -nap | grep pid

 

4.根据端口port查进程

  netstat -nap | grep port

 

  从形式上看, netstat -nap 更好记忆, 但lsof的用法也要熟练。

 

文章来源:https://blog.csdn.net/stpeace/article/details/69934763

相关文章:

  • 2021-11-18
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2021-11-18
  • 2022-02-02
猜你喜欢
  • 2021-08-18
  • 2021-11-18
  • 2021-06-15
  • 2021-11-08
  • 2021-11-18
相关资源
相似解决方案