查看是一个端口(比如80)是被哪个进程占用了(Linux)

to 0.0.0.0:80 failed (98: Address already in use)

ps -e | grep nginx netstat -ltunp

图片描述

你期待的结果是什么?实际看到的错误信息又是什么?

找到80 的pid 进行杀死进程

阅读 2.5k
2 个回答
  • lsof -i :80 #查看占用80端口的进程

netstat -p 需要 root 权限才可以看到所有用户的进程信息,否则只能看到自己的,其他用户的看不到。

PID/Program name
Slash-separated pair of the process id (PID) and process name of the process that owns the socket. --program causes this column to be included. You will also need superuser privileges to see this information on sockets you don't own.* This identification information is not yet available for IPX sockets.
推荐问题