一个命令行工具,用于杀死在指定端口上运行的进程和容器。
brew install killport
cargo install killport
curl -sL https://bit.ly/killport | sh
Add $HOME/.local/bin to your PATH if it's not already there.
Download pre-built binaries from the releases page. Each release includes shell completions and a man page.
killport [OPTIONS] <ports>...
Kill whatever is using port 8080:
killport 8080
Kill multiple ports at once:
killport 3000 8080 9090
Send SIGTERM instead of SIGKILL:
killport -s sigterm 8080
Dry run — see what would be killed:
killport --dry-run 8080
# Would kill process 'node' listening on port 8080
Kill only containers (skip native processes):
killport --mode container 8080
Suppress exit code 2 when nothing is found (useful in scripts):
killport --no-fail 8080
| Flag | Description |
|---|---|
-m, --mode <MODE> |
Target mode: auto (default), process, or container |
-s, --signal <SIG> |
Signal to send (default: SIGKILL). See supported signals |
--dry-run |
Preview what would be killed without terminating anything |
--no-fail |
Exit 0 even when no matching process or container is found |
-v, --verbose |
Increase verbosity (repeat for more: -vv, -vvv) |
-q, --quiet |
Decrease verbosity (repeat for less: -qq) |
-h, --help |
Show help |
-V, --version |
Show version |
| Code | Meaning |
|---|---|
0 |
Target(s) found and killed (or --no-fail was used) |
1 |
Error (permission denied, internal failure, etc.) |
2 |
No matching process or container found on the specified port(s) |
In auto mode (default), killport:
docker-proxy or OrbStack Helper are automatically skipped)Use --mode process or --mode container to target only one type.
Shell completions are included in release tarballs under completions/. To install:
bash — copy to ~/.local/share/bash-completion/completions/killport
zsh — copy to a directory in your $fpath (e.g., ~/.zsh/completions/_killport)
fish — copy to ~/.config/fish/completions/killport.fish
Contributions are welcome. See CONTRIBUTING.md and CODE_OF_CONDUCT.md.
暂无开放 Issues,或尚未同步最近议题。