portrm vs lsof + kill

Replace the 3-step lsof + grep + kill ritual with one intelligent command.

The Old Way vs The New Way

# The lsof ritual (every developer knows this pain):
$ lsof -i :3000
COMMAND  PID    USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
node    84921  user   23u  IPv6  0x...  0t0      TCP *:3000 (LISTEN)
$ kill -9 84921
# Was that safe? Who knows. Did it work? Check again.
$ lsof -i :3000
# OK, port is free. Now restart manually.

# The portrm way:
$ ptrm fix 3000 --run "npm run dev"
# Done. Identified, safety-checked, killed, restarted.

Comparison

Capabilitylsof + killportrm
Find process on portlsof -i :3000ptrm 3000
Kill processkill -9 PIDptrm fix 3000
Steps required3+ commands1 command
Service identificationProcess name onlyFull service type + confidence
Safety checksNone3-tier system
Graceful shutdownManual (kill vs kill -9)Automatic SIGTERM escalation
Readable outputCryptic columnsHuman-readable table
Auto-restartNo--run flag
Multiple portsSeparate commands eachptrm fix 3000 8080 -y
Works on WindowsNo (use netstat)Yes, cross-platform
Scan all portslsof -i -P -n (messy)ptrm scan

What You Actually Want to Know

lsof output is unreadable

lsof -i :3000 shows cryptic columns like FD, TYPE, DEVICE, SIZE/OFF that most developers never need. portrm shows what matters: the service name, memory usage, uptime, and whether it is safe to kill.

kill -9 is dangerous

When you kill -9 a process, it gets no chance to clean up. For a Node.js dev server, this is fine. For PostgreSQL, this can corrupt your database. You have to know the difference. portrm knows the difference for you.

Cross-platform pain

lsof works on macOS and Linux. On Windows, you need netstat -ano | findstr. On Linux, you might use ss or fuser. portrm uses the same command everywhere: ptrm fix 3000.

No restart

After killing with lsof + kill, you manually go back to your terminal and type the start command. portrm does it in one step: ptrm fix 3000 --run "npm run dev".

When to Still Use lsof

lsof is a general-purpose tool. Use it when you need:

For port management, portrm is the better tool.

Replace the lsof ritual

One command instead of three. Safety included.