Убивайте процессы по порту.
Красиво.

Молниеносный CLI, который находит и убивает процессы, занимающие ваши порты. Интерактивный TUI, режим наблюдения, деревья процессов и ноль зависимостей.

Загрузки npm (opens in new tab) Звёзды GitHub (opens in new tab)
0 Зависимостей
0 Платформы
0+ Тестов Пройдено
0 Языков

Почему slay?

Всё, что нужно для освобождения ваших портов.

Интерактивный TUI

Ищите, просматривайте и выбирайте несколько процессов с помощью клавиатурной навигации.

slay -i

Анимации Kill

Смотрите, как пуля летит через ваш терминал, когда процесс уничтожается.

slay 3000

Мягкое Завершение

Сначала SIGTERM, эскалация до SIGKILL только если процесс отказывается завершаться.

slay -g 3000

Режим Наблюдения

Продолжайте опрашивать и автоматически убивайте процессы, которые возрождаются на вашем порту.

slay -w 3000

Деревья Процессов

Убивайте всё дерево процессов, сначала дочерние, для чистого завершения.

slay --tree 3000

Вывод JSON

Передавайте NDJSON в jq для скриптов, CI пайплайнов и автоматизации.

slay --json 3000

Умные Метки

Автоматически распознаёт Node, Python, Docker, PostgreSQL, Vite и более 20 других.

slay --all

Ноль Зависимостей

Без лишнего. Поставляет только необходимое. Устанавливается менее чем за секунду.

npm i -g slay-port

Кроссплатформенный

Работает на macOS (lsof), Linux (lsof) и Windows (netstat + taskkill).

works everywhere ✓

Предустановки профилей

Сохраняйте комбинации портов как именованные профили.

slay --profile dev

Диапазоны портов

Убивайте диапазон портов с помощью slay 8000-8010.

slay 8000-8010

Информация о порте

Проверяйте порты без завершения. Смотрите PID, CPU, память.

slay info 3000

Автодополнение

Автодополнение команд, флагов и имён профилей в bash, zsh и fish.

slay completions zsh

Убить по имени

Находите процессы по имени с поддержкой регулярных выражений. Исключайте определённые процессы из массовых операций.

slay --name "node.*"

Хуки после убийства

Автоматически выполняйте команды после завершения — перезапуск серверов, запуск сборки или уведомление команды.

slay 3000 --then "npm start"

Доступность порта

Проверьте, свободны ли порты, найдите следующий доступный порт. Идеально для CI и автоматизации.

slay check 3000

Хватит угадывать PID

Старый способ мучителен. С slay — одна команда.

Старый способ

bash
$ lsof -iTCP:3000 -sTCP:LISTEN
node 12847 user 23u IPv4 TCP *:3000
$ kill -9 12847
$ lsof -iTCP:3000 -sTCP:LISTEN
# still alive... try again?
$ kill -SIGKILL 12847

Способ slay

slay
$ slay 3000
3000 > node PID 12847 (Dev Server)
killed PID 12847 on port 3000 [SIGKILL]
 
Done in 0.2s
 

Начало работы

Готов к работе за одну команду.

Быстрый Старт
npx slay-port 3000
Глобальная Установка
npm i -g slay-port && slay 3000
Быстрый Старт
pnpm dlx slay-port 3000
Глобальная Установка
pnpm add -g slay-port && slay 3000
Быстрый Старт
yarn dlx slay-port 3000
Глобальная Установка
yarn global add slay-port && slay 3000
Быстрый Старт
bunx slay-port 3000
Глобальная Установка
bun add -g slay-port && slay 3000
Быстрый Старт
brew install hammadxcm/slay/slay-port
Глобальная Установка
brew install hammadxcm/slay/slay-port && slay 3000
Быстрый Старт
sudo snap install slay-it --classic
Глобальная Установка
sudo snap install slay-it --classic && slay 3000
Быстрый Старт
sudo apt install slay-port
Глобальная Установка
sudo apt install slay-port && slay 3000
Быстрый Старт
scoop bucket add slay https://github.com/hammadxcm/scoop-slay && scoop install slay
Глобальная Установка
scoop install slay && slay 3000
Быстрый Старт
winget install hammadxcm.slay-port
Глобальная Установка
winget install hammadxcm.slay-port && slay 3000
Использование API
import { findByPort, killProcess } from 'slay-port'

Смотрите в действии

Пятнадцать способов уничтожить.

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

Kill by Name

slay --name "node.*"
$ slay --name "node.*" --exclude "vite"
PID 12847 node server.js (port 3000)
PID 13201 node worker.js (port 3001)
PID 14500 node vite.js (excluded)
killed 2 processes, 1 excluded

Post-Kill Hook

slay 3000 --then "npm start"
$ slay 3000 --then "npm start"
3000 > node PID 12847 (Dev Server)
killed PID 12847 on port 3000 [SIGKILL]
running hook: npm start
hook completed (exit 0)

Port Check

slay check 3000
$ slay check 3000
port 3000 is in use (node PID 12847)
$ slay check --next 3000
port 3002 is available

Init Config

slay init
$ slay init
✓ Created .slay.json with example profiles

Run Profile

slay --profile dev
$ slay --profile dev
3000 > node PID 12847 (Dev Server)
5173 > node PID 13201 (Vite)
5432 > pg PID 4510 (PostgreSQL)
killed 3 processes on 3 ports

Port Range

slay 8000-8005
$ slay 8000-8005
8000 > node PID 9001 (HTTP Alt)
8001 > node PID 9002 (HTTP Alt)
killed 2 processes on 2 ports (4 ports clear)

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]

Программный API

Используйте slay как библиотеку в ваших проектах на Node.js.

Экспорты

  • 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}` );
}