Kill processes by port. Beautifully.
# npm
npx slay-port 3000
npm i -g slay-port
# pnpm
pnpm dlx slay-port 3000
pnpm add -g slay-port
# yarn
yarn dlx slay-port 3000
yarn global add slay-port
# bun
bunx slay-port 3000
bun add -g slay-port
# Homebrew (macOS/Linux)
brew install hammadxcm/slay/slay-port
# Standalone binary (no runtime needed)
# Download from GitHub Releases: https://github.com/hammadxcm/slay/releasesFull docs & interactive demos at slay.fyniti.co.uk
Also available on JSR for Deno and modern TypeScript projects.
- Interactive TUI with search and multi-select
- Graceful shutdown — SIGTERM first, escalate to SIGKILL
- Watch mode — auto-kill processes that respawn
- Process tree killing — take down children first
- JSON output — pipe to
jqfor scripting - Dry run — preview what would be killed
- Smart labels — auto-detects Node.js, Python, Docker, PostgreSQL, and more
- Cross-platform — macOS, Linux, Windows
- Zero runtime dependencies
slay 3000slay 3000 8080 5432slay 3000 -fslay 3000 --softTip:
--softsends SIGTERM first and escalates to SIGKILL only if the process doesn't exit.
slay -islay 3000 -wslay 3000 -nslay 3000 -tslay --all -yslay 3000 --jsonslay 3000 --json | jq '.pid'slay 53 --udp| Flag | Description |
|---|---|
-f, --force |
SIGKILL immediately, skip prompt |
-y, --yes |
Skip confirmation prompt |
--soft |
SIGTERM first, escalate to SIGKILL |
-v, --verbose |
Show signal details, timing, protocol |
-n, --dry-run |
Preview what would be killed (no kill) |
-t, --tree |
Kill process tree (children first) |
--udp |
Target UDP ports instead of TCP |
--json |
Output NDJSON for scripting |
-w, --watch |
Keep polling & killing (Ctrl+C to stop) |
-i, --interactive |
TUI process selector |
--all |
Kill all listening processes |
-h, --help |
Show help |
Launch with slay -i to get a full TUI process selector.
| Key | Action |
|---|---|
| ↑ ↓ / j k | Navigate |
| Space | Toggle selection |
| a | Toggle all |
| / | Search |
| Enter | Confirm kill |
| q | Quit |
Slay auto-detects process types and known ports:
Recognized commands: Node.js, Python, Ruby, Java, Go, Deno, Bun, PHP, Nginx, Apache, Docker, Electron, VS Code
Known ports:
| Port | Label |
|---|---|
| 3000 | Dev Server |
| 4200 | Angular |
| 5173 | Vite |
| 5432 | PostgreSQL |
| 3306 | MySQL |
| 6379 | Redis |
| 8080 | HTTP Alt |
| 8888 | Jupyter |
| 27017 | MongoDB |
import { findByPort, killProcess, platform } from 'slay-port';
const procs = await findByPort(platform, 3000);
for (const proc of procs) {
const result = await killProcess(platform, proc);
console.log(`Killed PID ${result.pid} on port ${result.port}`);
}Exports:
findByPort,findByPorts,findAllListening— discoverykillProcess,killAll— killingenrichLabel,isSystemPort— labelsplatform,setPlatform— platform adapterSlayError— error type- Types:
ProcessInfo,KillResult,CliOptions,PlatformAdapter,KillErrorCode
When using --json, slay emits NDJSON with these event types:
src/
cli.ts Argument parsing & validation
core/
discovery.ts Port/process discovery
killer.ts Process killing logic
labels.ts Smart label resolution
platform/
index.ts Platform detection & adapter selection
unix.ts macOS/Linux (lsof)
windows.ts Windows (netstat/taskkill)
ui/
format.ts Output formatting
colors.ts Terminal colors
animation.ts Kill animations
prompt.ts Confirmation prompts
interactive.ts TUI selector
utils/
exec.ts Child process helpers
errors.ts Error types
| Platform | Backend |
|---|---|
| macOS | lsof |
| Linux | lsof |
| Windows | netstat + taskkill |
See CONTRIBUTING.md for development setup and guidelines.
Contributions of all kinds are welcome! Check out the good first issues to get started.
MIT — Hammad Khan