后端开发时,有时会碰到服务无法正常启动,端口被占用。这时需要查看端口占用情况。

是什么

需要用到一些Linux命令。

怎么做

查看占用端口51805的进程

lsof -n -P -i TCP -s TCP:LISTEN|grep 51805
# 或者
lsof -i:51805

延伸阅读

linux lsof命令详解

Linux netstat命令详解

每天一个linux命令(51):lsof命令

统计连接数

netstat -n | awk '/^tcp/{++S[$NF]}END{for(a in S) print a,S[a]}' 

相关文章:

  • 2021-09-04
  • 2022-02-04
  • 2021-12-07
  • 2021-05-23
  • 2021-09-10
猜你喜欢
  • 2021-11-02
  • 2021-07-23
  • 2022-12-23
  • 2021-08-11
  • 2022-12-23
  • 2021-07-21
相关资源
相似解决方案