如何找出哪个进程正在使用localhost:80?

8
我正在使用Linux Mint Xfce版本,我的localhost:80被某个程序占用了,但我不知道是哪一个程序。当我打开Firefox并访问localhost:80时,它显示:
“它运作了! 这是此服务器的默认网页。 Web服务器软件正在运行,但尚未添加任何内容。”
我尝试使用“lsof -i @ localhost:80”,但它没有返回任何结果。

lsof -i :80 也可以工作,但是添加 @localhost 后出了什么问题? - flyingfoxlee
2个回答

11

netstat -anpt | grep :80

以root用户身份执行该命令可以列出使用端口80的进程。关闭浏览器后,此命令可以帮助您确定具体进程。


你的信息似乎是关于Apache的。 - zeropol
感谢您的快速回答,它起作用了,实际上是apache2,它被绑定到ipv6地址。 - flyingfoxlee

2

试试这个:

# fuser -n tcp 80      

来自man手册:

-n SPACE, --namespace SPACE
      Select  a  different  name space.  The name spaces file (file names, 
      the default), udp (local UDP ports), and tcp (local TCP ports)
      are supported.  For ports, either the port number or the symbolic name can 
      be specified.  If there is no  ambiguity,  the  shortcut
      notation name/space (e.g. 80/tcp) can be used.

它(程序)运行成功了,谢谢你们两位,我从你们两位身上学到了很多。 - flyingfoxlee
很遗憾我只能选择一个答案作为被采纳的答案。 - flyingfoxlee

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接