npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

portclean

v1.1.0

Published

Kill processes using specific ports on macOS, Linux, and Windows

Readme

portclean

A fast, cross-platform CLI tool to kill processes using specific ports. Supports macOS, Linux, and Windows.

Installation

npm install -g portclean

Usage

portclean [ports...] [options]

Arguments:
  ports         Port number(s) or ranges to target (e.g. 3000 or 3000-3010)

Options:
  --force, -f   Skip confirmation prompt
  --all, -a     Kill all processes using each port
  --help, -h    Show help message
  --version, -v Show version number

Examples

Kill a single port with confirmation

$ portclean 3000
Processes on port 3000:
  1. PID 12345 (node)
Process 12345 (node) is using port 3000. Kill it? (y/N) y
✓ Killed process 12345 (node)

Kill multiple ports

$ portclean 3000 8080 9000
Processes on port 3000:
  1. PID 12345 (node)
Process 12345 (node) is using port 3000. Kill it? (y/N) y
✓ Killed process 12345 (node)

Processes on port 8080:
  1. PID 54321 (python)
Process 54321 (python) is using port 8080. Kill it? (y/N) y
✓ Killed process 54321 (python)

Processes on port 9000:
  1. PID 11111 (go)
Process 11111 (go) is using port 9000. Kill it? (y/N) y
✓ Killed process 11111 (go)

Kill without confirmation

$ portclean 3000 --force
Processes on port 3000:
  1. PID 12345 (node)
✓ Killed process 12345 (node)

Kill a port range

$ portclean 3000-3010 --force
Processes on port 3000:
  1. PID 12345 (node)
✓ Killed process 12345 (node)

...

Processes on port 3010:
  1. PID 12399 (go)
✓ Killed process 12399 (go)

Kill all processes using a port

When multiple processes are using the same port:

$ portclean 3000 --all
Processes on port 3000:
  1. PID 12345 (node)
  2. PID 12346 (node)
  3. PID 12347 (node)
Kill all 3 process(es) on port 3000? (y/N) y
✓ Killed process 12345 (node)
✓ Killed process 12346 (node)
✓ Killed process 12347 (node)

Kill all processes without confirmation

$ portclean 3000 8080 9000 --all --force
Processes on port 3000:
  1. PID 12345 (node)
  2. PID 12346 (node)
✓ Killed process 12345 (node)
✓ Killed process 12346 (node)

Processes on port 8080:
  1. PID 54321 (python)
✓ Killed process 54321 (python)

Processes on port 9000:
  1. PID 11111 (go)
✓ Killed process 11111 (go)

Kill processes on ports without --all (prompts per process)

$ portclean 3000-3002
Processes on port 3000:
  1. PID 12345 (node)
Process 12345 (node) is using port 3000. Kill it? (y/N) y
✓ Killed process 12345 (node)

Processes on port 3001:
  1. PID 12346 (node)
Process 12346 (node) is using port 3001. Kill it? (y/N) n

Processes on port 3002:
  1. PID 12347 (node)
Process 12347 (node) is using port 3002. Kill it? (y/N) y
✓ Killed process 12347 (node)

How it works

macOS/Linux

  1. Primary method: Uses lsof -i :<port> to find processes
  2. Fallback (Linux only): If lsof is not available, uses netstat -anp and parses the output (stderr suppressed)
  3. macOS fallback: macOS netstat lacks PID data, so we skip it and return no processes instead of printing errors
  4. Process names: Extracted from the command output or via ps command

Windows

  1. Uses netstat -ano to list all listening ports and their PIDs
  2. Uses tasklist /FI "PID eq <pid>" to get the process image name
  3. Sends SIGKILL equivalent via taskkill /PID <pid> /F

Exit Codes

  • 0: Successfully handled (killed or no process found)
  • 1: Invalid arguments, unsupported platform, or system errors

Development

Running tests

npm test

Smoke test

npm run smoke

Requirements

  • Node.js >= 14
  • macOS, Linux, or Windows
  • No additional system dependencies required

License

MIT