kp is a tool for kill process by server port
发布于 9 年前 作者 i5ting 4049 次浏览 最后一次编辑是 8 年前 来自 分享

kp

kp is a tool for kill process by server port. only use for mac && linux

npm version

Install

[sudo]npm install -g kp

Usage

default server port is 3000

kp

or kill by some port

kp 3002

or with sudo

kp 3002 -s or kp 3002 --sudo

目前centos和mac已经测过

类似项目https://github.com/sindresorhus/fkill-cli,支持win很简单,判断平台,然后使用taskkill干掉即可

欢迎关注我的公众号【node全栈】

node全栈.png

4 回复

fuser -k -n tcp 3002

fuser 来自 psmisc 这个包(killall 也在这个包里),Ubuntu 默认安装,其他系统不清楚。

挺实用的 马克

@jysperm 我以前也用fuser,但在mac上不能用

➜  timeline git:(master) ✗ fuser -k -n tcp 3002
Unknown option: k
Unknown option: n
fuser: [-cfu] file ...
	-c	file is treated as mount point
	-f	the report is only for the named files
	-u	print username of pid in parenthesis
	```
	
是我哪里用错了么?
回到顶部