在Mac上查找(和杀死)进程锁定端口3000(Find (and kill) process locking port 3000 on Mac)

系统教程 行业动态 更新时间:2024-06-14 16:57:17
在Mac上查找(和杀死)进程锁定端口3000(Find (and kill) process locking port 3000 on Mac)

如何查找/使用我的tcp端口的进程? 我在mac os x。

有时,在崩溃或一些错误之后,我的rails应用程序是锁定端口3000.我找不到它使用ps -ef ...如何找到愚蠢的事情,杀死它,残酷地...?

在做什么

rails server

我得到

地址已经在使用 - bind(2)(Errno :: EADDRINUSE)

2014年更新:

要完成以下一些答案:执行kill命令后,可能需要删除pid文件rm ~/mypath/myrailsapp/tmp/pids/server.pid

How do I find (and kill) processes that listen to/use my tcp ports? I'm on mac os x.

Sometimes, after a crash or some bug, my rails app is locking port 3000. I can't find it using ps -ef...

When doing

rails server

I get

Address already in use - bind(2) (Errno::EADDRINUSE)

2014 update:

To complete some of the answers below: After executing the kill commands, deleting the pid file might be necessary rm ~/mypath/myrailsapp/tmp/pids/server.pid

最满意答案

你可以试试netstat

netstat -vanp tcp | grep 3000

对于OSX El Capitan和更新版本(或者如果您的netstat不支持-p ),请使用lsof

lsof -i tcp:3000

You can try netstat

netstat -vanp tcp | grep 3000

For macOS El Capitan and newer (or if your netstat doesn't support -p), use lsof

sudo lsof -i tcp:3000

For Centos 7 use

netstat -vanp --tcp | grep 3000

更多推荐

本文发布于:2023-04-12 19:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/f64e0e363b18463d9b7e4647fafdf215.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:端口   进程   Mac   Find   locking

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!