Prompt file imported from DYAI2025/azodiac (
.claude/commands/remote-service-discovery.md). Copyright stays with the author.
Context
You are auditing what services are running on a remote system (Linux server, VPS, etc.) accessed via SSH. This helps quickly understand the system state and locate specific services.
Your Task
Discover running services, identify listening ports, locate service directories, and provide access information for services on a remote system.
Steps
-
Ask for Target Services What services is the user looking for?
- Specific service names (e.g., "nginx", "postgresql", "evermemos")
- Service categories (e.g., "web servers", "databases")
- Or "all" for complete system audit
-
Find Running Processes
ssh USER@HOST "ps aux | grep -E '(SERVICE1|SERVICE2|SERVICE3)' | grep -v grep"For broader search:
ssh USER@HOST "ps aux | grep -E '(python|node|java|nginx|apache|docker)' | grep -v grep" -
Identify Listening Ports
ssh USER@HOST "netstat -tulpn 2>/dev/null | grep LISTEN || ss -tulpn 2>/dev/null | grep LISTEN"Common ports to note:
- 80/443: HTTP/HTTPS
- 3000: Node.js/Next.js dev servers
- 5000: Flask/Python services
- 8000/8080: Alternative HTTP
- 27017: MongoDB
- 5432: PostgreSQL
- 6379: Redis
-
Locate Service Directories
ssh USER@HOST "find ~ -maxdepth 3 -type d -iname '*SERVICE_NAME*' 2>/dev/null"Common locations:
~/service-name/~/.service-name//opt/service-name//var/www/service-name/
-
Check Service Configuration
# Find config files ssh USER@HOST "find ~/SERVICE_DIR -name '*.conf' -o -name '*.config' -o -name '.env' -o -name 'config.json' 2>/dev/null" # Read important configs ssh USER@HOST "cat ~/SERVICE_DIR/config.json" 2>/dev/null -
Check Service Health
# Check logs ssh USER@HOST "tail -20 ~/SERVICE_DIR/logs/*.log 2>/dev/null" # For systemd services ssh USER@HOST "systemctl --user status SERVICE_NAME" # Check if web service responds ssh USER@HOST "curl -s http://localhost:PORT/health || curl -s http://localhost:PORT/" -
Provide Access Summary
Create a summary showing:
- Service Name
- Status: Running / Stopped
- PID: Process ID
- Port(s): Listening ports
- Directory: Installation path
- Access URL: How to reach it
- Local:
ssh -L PORT:localhost:PORT USER@HOSTthenhttp://localhost:PORT - Tailscale:
http://TAILSCALE_IP:PORT - Public:
http://HOST:PORT(if exposed)
- Local:
Discovery Patterns
Web Services:
ssh USER@HOST "ps aux | grep -E '(next|nginx|apache|node.*server|python.*app)' | grep -v grep"
ssh USER@HOST "netstat -tulpn | grep -E ':(80|443|3000|8000|8080)'"
Databases:
ssh USER@HOST "ps aux | grep -E '(mongod|postgres|mysql|redis)' | grep -v grep"
ssh USER@HOST "netstat -tulpn | grep -E ':(27017|5432|3306|6379)'"
AI/ML Services:
ssh USER@HOST "ps aux | grep -E '(python.*server|jupyter|streamlit|gradio|ollama)' | grep -v grep"
Docker Containers:
ssh USER@HOST "docker ps"
ssh USER@HOST "docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'"
Guardrails
- Use grep -v grep to exclude the grep command itself from results
- Check both netstat and ss (ss is newer, but not always available)
- Search home directory first (
~) before system directories - Limit find depth to avoid scanning entire filesystem (use -maxdepth)
- Handle permission errors gracefully (use
2>/dev/null)
Output Format Example
═══ SERVICE DISCOVERY REPORT ═══
Service: EverMemOS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Status: Running
PID: 4112242
Port: 8000 (HTTP)
Directory: /home/dyai/EverMemOS
Access: http://100.103.64.33:8000
Logs: /home/dyai/EverMemOS/logs/
Service: Selina (Next.js)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Status: Running
PID: 3911037
Port: 3000 (HTTP)
Directory: /home/dyai/seline
Access: http://100.103.64.33:3000
Logs: /tmp/seline-nextdev.log
Service: Selina Audio
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Status: Running
PID: 1021714
Port: 8100 (HTTP) - localhost only
Directory: /home/dyai/selina-audio
Access: ssh -L 8100:localhost:8100 USER@HOST
Generated by /reflect-skills from remote service discovery patterns
