dev-killport: Kill Processes by Port

A cross-platform command-line utility to identify and kill processes bound to a specific port. Stop hunting through Task Manager or grepping netstat output — just tell dev-killport which port you need freed and it handles the rest.

Overview

dev-killport is a .NET global tool for developers who regularly run into "port already in use" errors. Whether a previous debug session left a zombie process behind, or you need to reclaim a port from a runaway service, dev-killport gives you a single command to find what's holding a port and terminate it.

It works on Windows, macOS, and Linux using OS-native process discovery, so there's nothing extra to install beyond the .NET SDK. Output is clean and tabular by default, with a JSON option for scripting and automation.

Installation

dotnet tool install --global dev-killport

To update the tool to the latest version:

dotnet tool update --global dev-killport

Because the tool is installed globally, you can run dev-killport from any directory in your terminal.

Features

Kill by Port

Pass a port number and dev-killport finds every process bound to it, prompts you for confirmation, and terminates the process. Use --force to skip the prompt or --all to kill every matching process at once.

dev-killport kill 5000

Port 5000 is used by:
 PID   Name    Protocol  State
 1234  dotnet  TCP       Listen

Kill this process? [y/n] (n): y
Successfully killed process dotnet (PID: 1234).

Dry-Run Mode

Not sure what's on a port? Use --dry-run to preview exactly what would be killed without actually terminating anything. Great for double-checking before you pull the trigger in production-adjacent environments.

dev-killport kill 5000 --dry-run

View Port Usage

The view command shows which processes are bound to a specific port without killing anything. Handy when you just want to diagnose what's occupying a port before deciding what to do about it.

dev-killport view 8080

Port 8080 is used by:
 PID   Name    Protocol  State
 5678  node    TCP       Established

List All Port Bindings

Use the list command to see every active port binding on the system in one table. Filter by protocol with --protocol tcp or --protocol udp to narrow things down.

dev-killport list

All ports with active processes:
 Port   PID    Name     Protocol  State
 5000   1234   dotnet   TCP       Listen
 8080   5678   node     TCP       Established
 27017  9012   mongod   TCP       Listen

Watch Mode

After killing a process, use --watch to poll until the port is actually freed. This is useful when a process takes a moment to release its socket. Set a custom timeout with --timeout.

dev-killport kill 5000 --force --watch --timeout 60

JSON Output

Add --json to any command for machine-readable output. Pipe it into jq, feed it to a script, or integrate it into your CI pipeline.

dev-killport view 5000 --json

{
  "port": 5000,
  "processes": [
    {
      "pid": 1234,
      "name": "dotnet",
      "protocol": "TCP",
      "state": "Listen"
    }
  ]
}

Interactive REPL Mode

Running dev-killport with no arguments starts an interactive session where you can run multiple commands without re-launching the tool. Type exit to quit or --help to list available commands.

killport> kill 5000 --dry-run
killport> view 8080 --json
killport> list --protocol tcp
killport> exit

Cross-Platform Support

dev-killport works on Windows (PowerShell), macOS, and Linux using native OS tools like ss, lsof, and /proc. There's nothing extra to configure — it detects your platform and uses the right approach automatically.

Commands

USAGE:
    dev-killport [COMMAND] [OPTIONS]

OPTIONS:
    -h, --help    Prints help information

COMMANDS:
    kill <PORT>    Find and kill processes bound to a port    (alias: k)
    view <PORT>    View processes bound to a port             (alias: v)
    list           List all ports with mapped process details (alias: ls)

kill

Find and terminate processes on a given port. Prompts for confirmation by default. Supports force mode, dry-run, watch mode, protocol filtering, and JSON output.

# Kill process on port 5000 (with confirmation prompt)
dev-killport kill 5000

# Kill without confirmation
dev-killport kill 5000 --force

# Kill all matching processes
dev-killport kill 5000 --all --force

# Preview without killing
dev-killport kill 5000 --dry-run

# Kill and wait until port is free
dev-killport kill 5000 --watch --timeout 60

view

Display processes bound to a specific port without killing them. Use --protocol to filter by TCP or UDP, and --json for machine-readable output.

# View processes on port 5000
dev-killport view 5000

# View only TCP processes
dev-killport view 5000 --protocol tcp

# View as JSON
dev-killport view 5000 --json

list

List all active port bindings on the system with their mapped process details. Filter by protocol or output as JSON.

# List all port bindings
dev-killport list

# List only UDP bindings
dev-killport list --protocol udp

# List as JSON
dev-killport list --json

Getting Started

Install the tool, then run dev-killport view <PORT> to see what's on a port, or dev-killport kill <PORT> to free it up. The confirmation prompt keeps you safe by default — add --force when you're sure.

dotnet tool install --global dev-killport
dev-killport view 5000
dev-killport kill 5000

If you have feedback, bugs, or feature suggestions, please file them in the Issues section of the repository.

Ready to stop fighting with occupied ports?

An unhandled error has occurred. Reload 🗙