kp3
v0.1.0
Published
Kill the process bound to a TCP port from the command line
Readme
kp
kp is a tiny cross-platform CLI that finds the process bound to a TCP port and sends it a signal. Install it globally via npm or Homebrew and terminate a port hog with a single command.
Install
# npm (global)
npm install -g kp3
# Homebrew
brew tap aboutmydreams/kp
brew install kpThe npm package name is
kp3. Once you secure the unscopedkpname on npm you can rename the package and update these commands.
Usage
kp <port> [options]| Option | Description |
| --- | --- |
| -f, --force | Send SIGKILL instead of SIGTERM |
| --signal=<name> | Send an explicit signal (overrides --force) |
| -h, --help | Show the inline help |
Examples:
kp 5173 # send SIGTERM (default) to any PID on TCP port 5173
kp 8080 --force # force kill
kp 3000 --signal=SIGINTWhen no processes are bound to the port you will see No process found listening on TCP port <port>.
Requirements
- Node.js 14 or newer (used for the CLI runtime)
- One of
lsof,fuser,ss, ornetstatmust be available on the host (macOS and most Linux distributions ship with at least one of these)
Local development
npm install
npm link # exposes `kp` in your PATH while developingYou can test the CLI directly:
kp 3000
kp 8080 --force
kp 5000 --signal=SIGINTRelease workflow (npm + Homebrew)
- Update
package.jsonwith the new version (npm version <patch|minor|major>). - Commit the changes and tag the release:
git commit -am "Release vX.Y.Z" && git tag vX.Y.Z. - Publish to npm:
npm publish --access public. - Push the branch and tag:
git push origin main --tags. - Create a GitHub release from tag
vX.Y.Zand attach the source tarball (or rely on the auto-generated archive). - In
homebrew-kp/Formula/kp.rb, updateurlif the version changed and replacesha256with the checksum of the new archive:curl -L -o kp.tar.gz https://github.com/aboutmydreams/kp/archive/refs/tags/vX.Y.Z.tar.gz shasum -a 256 kp.tar.gz - Commit and push the updated formula to
aboutmydreams/homebrew-kp, then tag it if desired.
Once these steps are complete, users can upgrade via either npm or Homebrew.
License
MIT
