Tuez les processus par port.
Avec élégance.

Un CLI ultra-rapide qui trouve et tue les processus qui occupent vos ports. TUI interactif, mode surveillance, arbres de processus et zéro dépendance.

Pourquoi slay?

Tout ce qu'il faut pour récupérer vos ports.

TUI Interactif

Recherchez, parcourez et sélectionnez plusieurs processus avec la navigation au clavier.

Animations de Kill

Regardez une balle traverser votre terminal quand un processus est éliminé.

Arrêt Gracieux

SIGTERM d'abord, escalade vers SIGKILL uniquement si le processus refuse de s'arrêter.

Mode Surveillance

Continuez à sonder et tuez automatiquement les processus qui réapparaissent sur votre port.

Arbres de Processus

Tuez l'arbre de processus entier, enfants d'abord, pour un arrêt propre.

Sortie JSON

Envoyez du NDJSON vers jq pour le scripting, les pipelines CI et l'automatisation.

Labels Intelligents

Détecte automatiquement Node, Python, Docker, PostgreSQL, Vite et plus de 20 autres.

Zéro Dépendance

Pas de superflu. N'embarque que le nécessaire. S'installe en moins d'une seconde.

Multiplateforme

Fonctionne sur macOS (lsof), Linux (lsof) et Windows (netstat + taskkill).

Pour commencer

Opérationnel en une seule commande.

Démarrage Rapide
npx slay-port 3000
Installation Globale
npm i -g slay-port && slay 3000
Démarrage Rapide
pnpm dlx slay-port 3000
Installation Globale
pnpm add -g slay-port && slay 3000
Démarrage Rapide
yarn dlx slay-port 3000
Installation Globale
yarn global add slay-port && slay 3000
Démarrage Rapide
bunx slay-port 3000
Installation Globale
bun add -g slay-port && slay 3000
Démarrage Rapide
brew install hammadxcm/slay/slay-port
Installation Globale
brew install hammadxcm/slay/slay-port && slay 3000
Utilisation API
import { findByPort, killProcess } from 'slay-port'

Voyez-le en action

Douze façons d'éliminer.

Basic Kill

slay 3000
$ slay 3000
3000 > node PID 12847 (Dev Server)
* *
***
killed PID 12847 on port 3000 [SIGKILL]

Interactive Mode

slay -i
$ slay -i
> 3000 node PID 12847 Dev Server
8080 python PID 9321 HTTP Alt
5432 pg PID 4510 PostgreSQL
↑↓ navigate space select enter confirm

Watch Mode

slay 3000 -w
$ slay 3000 -w
watching port 3000...
killed PID 12847 [SIGKILL]
watching port 3000...
process respawned as PID 12901
killed PID 12901 [SIGKILL]
watching port 3000...

Force Kill

slay 3000 -f
$ slay 3000 -f
3000 > node PID 12847 (Dev Server)
*========================***
killed PID 12847 on port 3000 [SIGKILL]
no confirmation needed (-f)

Graceful Shutdown

slay 3000 --soft
$ slay 3000 --soft
3000 > node PID 12847 (Dev Server)
sending SIGTERM...
waiting for graceful exit (5s)...
process exited gracefully [SIGTERM]

Multi-port

slay 3000 8080 5432
$ slay 3000 8080 5432
3000 > node PID 12847 (Dev Server)
8080 > python PID 9321 (HTTP Alt)
5432 > pg PID 4510 (PostgreSQL)
killed 3 processes on 3 ports

Dry Run

slay 3000 -n
$ slay 3000 -n
3000 > node PID 12847 (Dev Server)
[dry run] would kill PID 12847
no processes were harmed

Process Tree

slay 3000 -t
$ slay 3000 -t
3000 > node PID 12847 (Dev Server)
└─ PID 12848 (worker)
└─ PID 12849 (worker)
killed tree: 12849, 12848, 12847

JSON Output

slay 3000 --json
$ slay 3000 --json
{"type":"found","pid":12847,"port":3000}
{"type":"killed","pid":12847,"signal":"SIGKILL"}
{"type":"summary","killed":1,"failed":0}

UDP Ports

slay 53 --udp
$ slay 53 --udp
53/udp > mDNSResponder PID 289
*========================***
killed PID 289 on port 53/udp [SIGKILL]

All Listeners

slay --all -y
$ slay --all -y
scanning all ports...
found 5 listening processes
killed 5/5 processes
0 failed

Verbose Mode

slay 3000 -v
$ slay 3000 -v
[tcp] 3000 > node PID 12847
[signal] sending SIGKILL to 12847
[timing] kill took 12ms
killed PID 12847 on port 3000 [SIGKILL]

Programmatique API

Utilisez slay comme bibliothèque dans vos projets Node.js.

Exports

  • findByPort(platform, port) Find processes on a specific port
  • findByPorts(platform, ports) Find processes on multiple ports
  • findAllListening(platform) Find all listening processes
  • killProcess(platform, proc) Kill a single process
  • killAll(platform, procs) Kill multiple processes
  • enrichLabel(proc) Add smart labels to a process
api.ts
import { findByPort, killProcess, platform }
from 'slay-port';
 
const procs = await findByPort(platform, 3000);
 
for (const proc of procs) {
const result = await killProcess(platform, proc);
console.log( `Killed $${result.pid} on $${result.port}` );
}