portslayer-cli
v1.0.1
Published
Cross-platform CLI to inspect and kill processes by port on Windows, macOS, and Linux.
Maintainers
Readme
portslayer
Cross-platform CLI to inspect and kill processes by port on Windows, macOS, and Linux.
Why portslayer?
- Works across all major desktop/server OSes.
- Interactive by default when run in a terminal.
- Script-friendly with flags and JSON output.
- Gives clear kill summaries and useful failure messages.
Install
npm install -g portslayer-cliQuick Usage
portslayer list
portslayer check 3000
portslayer kill 3000Commands
portslayer list
Lists listening TCP ports and process ownership.
Flags:
--jsonmachine-readable output--no-colordisable colors--verboseinclude extra details
portslayer check <port>
Checks whether a specific port is in use.
Exit code behavior:
0port is free1port is occupied2invalid user input (for example invalid port)
portslayer kill [port]
Kills process(es) bound to the target port.
If port is omitted in interactive terminals, portslayer prompts for it.
Flags:
--port <number>provide port as named option--allkill all PIDs listening on the port--forceforce termination (taskkill /F,kill -9)--dry-runshow what would be killed--yesskip confirmation prompt--jsonmachine-readable output
Examples
# Interactive kill flow
portslayer kill
# Kill all processes on port 5173 without confirmation
portslayer kill 5173 --all --yes
# CI-friendly JSON mode
portslayer check 8080 --json
# Inspect before kill
portslayer kill 3000 --dry-runLocal Development
npm install
npm run typecheck
npm test
npm run buildRun compiled CLI:
node dist/cli.js listPublish To npm
- Update
package.jsonmetadata fields (repository,bugs,homepage,author). - Login to npm:
npm login - Publish:
npm publish --access public
Optional release automation with np:
npx npTroubleshooting
- Linux/macOS: if process metadata is missing, run with higher permissions.
- Linux: if
lsofis unavailable, install it or ensuressis present. - Windows: if kill fails, retry with elevated terminal and
--force.
