我怎样才能杀死正在使用端口 8080 的任何进程,以便我可以流浪? [英] How can I kill whatever process is using port 8080 so that I can vagrant up?

查看:24
本文介绍了我怎样才能杀死正在使用端口 8080 的任何进程,以便我可以流浪?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 MacOSX 上,我使用 Packer 来构建一个 Vagrant 盒子,所以我需要不断地把它拿出来拆掉.我正在尝试流浪",并收到标准错误,因为端口正在使用中:

On MacOSX, I'm using Packer to build a Vagrant box so I need to continually bring it up and tear it down. I'm attempting to 'vagrant up', and receive the standard error because the port is in use:

Vagrant 无法转发此 VM 上的指定端口,因为它们会与已经在侦听这些端口的其他应用程序发生冲突.转发到 8080 的端口已在主机上使用."

"Vagrant cannot forward the specified ports on this VM, since they would collide with some other application that is already listening on these ports. The forwarded port to 8080 is already in use on the host machine."

解决方案似乎很简单:我只需要识别打开端口 8080 的进程并杀死该进程,对吗?没那么容易.

The solution seems simple enough: I just need to identify the process that is holding port 8080 open and kill that process, right?. It's not that easy.

如果我运行命令:

nmap localhost -p 8080

我收到以下输出:

PORT     STATE SERVICE
8080/tcp open  http-proxy

<小时>

如果我运行以下命令:


If I run the following command:

top -o prt

1360 中使用的最高端口

The highest port in use in 1360

如果我运行以下命令:

 netstat -tulpn | grep :8080

我收到:

netstat: n: unknown or uninstrumented protocol

<小时>

如果我运行以下命令:


If I run the following command:

lsof -i :8080

我没有收到任何输出

如果我重新启动计算机,端口现在可用,我现在可以流浪".

If I restart my computer, the port is now available and I can now 'vagrant up'.

如何终止使用端口 8080 的任何进程,以便我可以在不重新启动计算机的情况下进行流浪?

How can I kill whatever process is using port 8080 so that I can vagrant up without restarting my computer?

推荐答案

这可能有帮助

lsof -n -i4TCP:8080 

PID 是输出中的第二个字段.

The PID is the second field in the output.

或者尝试:

lsof -i -P

这篇关于我怎样才能杀死正在使用端口 8080 的任何进程,以便我可以流浪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆