port-killer
Skill1 starsChanged 6 months agoMITView on GitHub
找出占用某端口的进程,列出 PID/命令/用户并给出 kill 命令;默认只查不杀,加 --kill --yes 才真杀。当用户说「X 端口被占了 / 杀掉占 X 端口的进程 / 谁在用 8080 / port killer」时触发。
In this repository35 other files it gives its agents.
- branch-cleanerSkill
- changelog-zhSkill
- claude-code-zhSkill
- code-haikuSkill
- commit-guard-zhSkill
- commit-roastSkill
- conflict-resolver-zhSkill
- cron-regex-buddySkill
- curl-buddySkill
- dep-auditSkill
- dockerfile-doctorSkill
- doc-syncSkill
- env-doctorSkill
- error-explain-zhSkill
- figma-to-pageSkill
- git-blame-storySkill
- gitignore-doctorSkill
- git-undoSkill
- go-migration-guardSkill
- json-yaml-doctorSkill
- lambda-logs-zhSkill
- license-pickerSkill
- mermaid-buddySkill
- mock-data-genSkill
- naming-buddySkill
- pr-desc-zhSkill
- readme-initSkill
- skill-doctorSkill
- skill-scaffoldSkill
- slack-to-specSkill
- source-to-specSkill
- sql-explain-zhSkill
- standup-zhSkill
- test-gen-zhSkill
- tldr-thisSkill
The file
Files
port-killer — 端口占用查杀
找出哪个进程在占用指定 TCP 端口,列出 PID / 命令 / 用户,给出杀进程命令——默认只查不杀,杀之前先让用户确认。
何时触发
- "8080 端口被占了"
- "谁在用 3000 端口"
- "帮我杀掉占 9000 端口的进程"
- "port killer"
- "kill port X"
- "这个端口被占了,启不起来"
工作流
- 查:跑
whoport.sh <端口>,展示占用该端口的进程信息(PID / 命令 / 用户)。 - 展示:把结果呈现给用户,同时给出建议的 kill 命令供参考。
- 确认:若用户说"杀掉它",先复述将要杀的进程,等用户明确同意。
- 杀:用户确认后,跑
whoport.sh <端口> --kill --yes执行 SIGTERM。
默认只查,不自动杀。 杀进程是有副作用的操作,必须显式
--kill --yes且用户已确认。
用法
# 只查(展示占用进程 + 建议命令,不杀)
bash <skill>/bin/whoport.sh 8080
# 查并杀(SIGTERM,需 --yes 二次确认)
bash <skill>/bin/whoport.sh 8080 --kill --yes输出示例(只查)
端口 8080 被以下进程占用:
PID 命令 用户
12345 python3 alice
12346 uvicorn alice
建议:kill 12345 12346
顽固进程:kill -9 12345 12346
(本次仅查询,未执行 kill)输出示例(加 --kill --yes)
将要杀死以下进程(SIGTERM):
PID 命令 用户
12345 python3 alice
已执行:kill 12345环境变量
| 变量 | 说明 |
LSOF | 覆盖 lsof 二进制路径(默认 lsof) |
边界
- 只找 TCP LISTEN 状态(不含 UDP、已建立连接)。
- 只发 SIGTERM(不自动 -9);顽固进程需用户手动
kill -9。 - 需要
lsof;没有时脚本给出ss -ltnp/netstat替代命令提示并 exit 1。 - 端口号须为 1-65535 的整数,否则报错并 exit 1。
- 不修改任何系统配置,只读 lsof 输出 + 发送信号。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

