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

@ashhitch/portctl

v0.1.1

Published

A cross-platform terminal UI for listing TCP listening ports and killing the processes that own them. Useful for quickly freeing up a port that's stuck occupied by a runaway or background process.

Readme

portctl

A cross-platform terminal UI for listing TCP listening ports and killing the processes that own them. Useful for quickly freeing up a port that's stuck occupied by a runaway or background process.

Built with Bun and @opentui/core. No other dependencies.

Features

  • Lists all TCP LISTEN sockets with owning PID and process name
  • Cross-platform: macOS, Linux, and Windows
  • Sortable by port number
  • Auto-refresh every 5 seconds, plus manual refresh on demand
  • Inline y/N confirmation before killing — no accidental terminations
  • IPv4, IPv6, and wildcard (*) addresses supported
  • Alternate-screen TUI that restores your terminal on exit

Requirements

  • Bun runtime
  • Platform-specific CLI tools available on PATH:
    • macOS: lsof
    • Linux: ss (preferred), falls back to netstat, then lsof
    • Windows: netstat and tasklist

Some system-owned ports (e.g. ports < 1024) may not appear or may refuse to be killed without elevated privileges. Run with appropriate permissions if you need to manage those.

Install

The CLI is built on Bun and OpenTUI's native renderer, so Bun must be installed and on your PATH to run it.

# from npm
npm install -g @ashhitch/portctl
# or run once without installing
npx @ashhitch/portctl

npx/npm only fetch the package — they don't install Bun. If you don't have it yet, install it first: curl -fsSL https://bun.sh/install | bash

For local development:

bun install

Run

# via the installed binary
portctl

# from source
bun index.ts
# or
bun run start

Controls

| Key | Action | | -------------- | --------------------------------------- | | / | Move selection | | Enter | Prompt to kill the selected process | | y / n | Confirm / cancel the kill prompt | | r | Refresh the port list | | q | Quit | | Ctrl+C | Quit |

The list refreshes automatically every 5 seconds. Manual refresh with r preserves your current selection when possible.

How it works

src/ports.ts shells out to the platform's native networking tools, parses their output into a common PortEntry shape, and exposes two functions:

  • listListeningPorts() — returns TCP listeners sorted by port
  • killProcess(pid) — sends SIGTERM (then SIGKILL on failure) on Unix, or runs taskkill /F /PID on Windows

index.ts renders the TUI using OpenTUI's imperative Renderable API. The layout is a header (title + help), a scrollable Select of ports, and a footer showing port count, last refresh time, and the active confirmation prompt.

Project layout

portctl/
├── index.ts          # TUI: layout, key handling, refresh + kill flow
├── src/
│   └── ports.ts      # Cross-platform port detection and process killing
├── package.json
└── bun.lock

License

MIT