पोर्ट से प्रोसेस बंद करें।
खूबसूरती से।

एक तेज़ CLI जो आपके पोर्ट पर कब्जा करने वाली प्रोसेस को ढूंढकर बंद करता है। इंटरैक्टिव TUI, वॉच मोड, प्रोसेस ट्री, और शून्य डिपेंडेंसी।

npm डाउनलोड (opens in new tab) GitHub स्टार (opens in new tab)
0 डिपेंडेंसी
0 प्लेटफ़ॉर्म
0+ टेस्ट पास
0 भाषाएं

क्यों slay?

अपने पोर्ट वापस पाने के लिए सब कुछ।

इंटरैक्टिव TUI

कीबोर्ड नेविगेशन से प्रोसेस खोजें, ब्राउज़ करें और मल्टी-सेलेक्ट करें।

slay -i

किल एनिमेशन

जब कोई प्रोसेस बंद होती है तो टर्मिनल में गोली उड़ते हुए देखें।

slay 3000

ग्रेसफुल शटडाउन

पहले SIGTERM, प्रोसेस बंद न हो तो ही SIGKILL पर जाएं।

slay -g 3000

वॉच मोड

लगातार पोलिंग करें और आपके पोर्ट पर फिर से आने वाली प्रोसेस को ऑटो-किल करें।

slay -w 3000

प्रोसेस ट्री

पूरे प्रोसेस ट्री को बंद करें, पहले चिल्ड्रन, साफ़ टियरडाउन के लिए।

slay --tree 3000

JSON आउटपुट

स्क्रिप्टिंग, CI पाइपलाइन और ऑटोमेशन के लिए NDJSON को jq में पाइप करें।

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'

देखें एक्शन में

पंद्रह तरीके से slay करें।

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

अपने Node.js प्रोजेक्ट में slay को लाइब्रेरी के रूप में उपयोग करें।

एक्सपोर्ट्स

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