/port-check - Check Port Status
Check if a port is in use and identify the process using it.
System Prompt
EXECUTION DIRECTIVE: When /port-check is invoked, IMMEDIATELY check port status.
Usage
/port-check 3000 # Check if port 3000 is in use
/port-check 3000 8080 5432 # Check multiple ports
/port-check --range 3000-3010 # Check port range
/port-check --common # Check common dev ports
/port-check --kill 3000 # Kill process on port (with confirmation)
Execution
~/.coditect/scripts/port-check.sh 3000
~/.coditect/scripts/port-check.sh 3000 8080 5432
~/.coditect/scripts/port-check.sh --range 3000-3010
~/.coditect/scripts/port-check.sh --common
Common Development Ports
| Port | Service |
|---|---|
| 3000 | React/Next.js dev |
| 3001 | Alternate frontend |
| 4000 | GraphQL |
| 5000 | Flask/Python |
| 5173 | Vite |
| 5432 | PostgreSQL |
| 6379 | Redis |
| 8000 | Django |
| 8080 | HTTP alternate |
| 8888 | Jupyter |
| 9000 | PHP-FPM |
| 27017 | MongoDB |
Output Format
Single Port
======================================================================
Port Check: 3000
======================================================================
Status: IN USE
Process: node (PID: 12345)
Command: node /Users/dev/project/server.js
User: halcasteel
Started: 2026-01-15 04:30:00
======================================================================
Port Available
======================================================================
Port Check: 3000
======================================================================
Status: AVAILABLE
Port 3000 is free to use.
======================================================================
Multiple Ports
======================================================================
Port Status
======================================================================
Port Status Process PID
---- ------ ------- ---
3000 IN USE node 12345
3001 AVAILABLE - -
5432 IN USE postgres 789
6379 IN USE redis-server 456
8080 AVAILABLE - -
Summary: 3/5 ports in use
======================================================================
Options
| Flag | Description |
|---|---|
PORT | Single port number |
PORT PORT... | Multiple ports |
--range START-END | Port range |
--common | Check common dev ports |
--kill PORT | Kill process (asks confirmation) |
--json | JSON output |
Implementation
#!/bin/bash
PORT=$1
# macOS
lsof -i :$PORT -P -n | grep LISTEN
# Linux alternative
# netstat -tlnp | grep :$PORT
# ss -tlnp | grep :$PORT
Related Commands
| Command | Purpose |
|---|---|
/health-check | System health |
/env-check | Environment check |
Version: 1.0.0 Created: 2026-01-15 Author: CODITECT Team