如何使用 TCP 端口查找进程? [英] How to find process using TCP port?

查看:47
本文介绍了如何使用 TCP 端口查找进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启动 http 几次后,我得到了这个错误,就像 Go 的实例没有停止!?

After starting a http a couple of times I get this error like an instance of Go has not stopped!?

listen tcp :9000: bind: address already in use

我在 nodejs 也遇到过类似的情况,但我能够杀死进程.不幸的是,我似乎找不到进程 ID 并杀死它.

I have experienced something like this with nodejs too but I was able to kill the process.. Unfortunately it seems like I can't find the process id and kill it..

如何释放" tcp 端口?

How to "free" the tcp port?

推荐答案

如果您使用的是类 unix 系统,您可以使用 netstat 找出正在侦听端口的进程:

If you are on unix like system you can use netstat to find out which process is listening on a port:

sudo netstat -nlp | grep 9000

原来 -p 选项在 OS X 上不可用.如果你使用的是 OS X,你可以这样做:

Turns out the -p option is not available on OS X. If you are using OS X you can do this:

lsof -n -i4TCP:$PORT | grep LISTEN

谁在监听在 Mac OS X 上给定 TCP 端口?

这篇关于如何使用 TCP 端口查找进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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