DEV Community

Prince
Prince

Posted on

BLITZ: Kill Processes 10x Faster Than lsof + A Speed Comparison with ps/grep/htop

I got frustrated with killing processes. Every time I needed to find what's using port 8080, I'd chain together lsof + grep + awk. Every time I wanted to kill something, I'd confirm it manually. Every time I monitored a process, I'd context-switch to htop.

So I built BLITZ. A process manager that actually works the way devs think.

The Speed Problem

Let me show you the actual time difference:

Finding what's on port 8080:

Old way:
$ time lsof -i :8080 | grep LISTEN | awk '{print $2}' | xargs kill -9
real 0m0.847s

BLITZ:
$ time bz port 8080
real 0m0.089s

That's 9.5x faster.

But speed isn't the point. It's clarity. Here's what you get:

$ bz port 8080
Found: node (PID 1234)
Kill? [y/N]:

vs.

$ lsof -i :8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 1234 prince 45u IPv4 0x123abcd 0t0 TCP localhost:8080 (LISTEN)

One is a question. One is a puzzle.

Speed Comparison: All Methods

Task BLITZ ps + grep lsof htop
Find process on port 8080 0.089s 1.2s 0.847s N/A
Kill process safely 1 command Multiple Multiple N/A
List all processes 0.034s 0.041s N/A N/A
Top 10 by memory 0.045s 2.3s N/A 0.8s
Real-time monitor Built-in N/A N/A Yes

(Tested on 500+ process systems, average of 10 runs)

Why BLITZ exists

The Unix philosophy is "do one thing well." But killing processes isn't one thing. It's:

  1. Finding the process (grep, awk, or lsof syntax)
  2. Confirming you got the right one (human check)
  3. Deciding how to kill it (kill vs kill -9)
  4. Executing without destroying critical processes

BLITZ combines all four into one intuitive command.

How to use it

bz # Show all processes (beautiful, colored)
bz top # Top 10 by memory
bz port 8080 # Find what's on that port
bz kill chrome # Kill by name (asks first)
bz kill chrome -f # Force kill without asking
bz watch java # Real-time monitoring
bz stats # CPU/RAM/disk

Install

git clone https://github.com/hunzo1/blitz.git
cd blitz
pip install -e .
bz # works from anywhere

Works on Linux, macOS, and Termux. Open source. No dependencies except psutil.

The Benchmark Details

If you want to reproduce these numbers:

Speed test: find process on random port

for i in {1..10}; do time bz port $((RANDOM + 2000)); done

Comparison with lsof chain

for i in {1..10}; do time (lsof -i :$((RANDOM + 2000)) | grep LISTEN); done

BLITZ wins on clarity, speed, and UX. The code is 320 lines of Python. Fully open source.

What's next

I'm open to feedback. If you use process management daily (and most developers do), try it out. Let me know what breaks.

Source: https://github.com/hunzo1/Blitz

Top comments (0)