Monitoring bash Advanced

Node.js Heap Snapshot via CLI

Trigger and download a V8 heap snapshot from a running Node.js process.

bash
#!/bin/bash
PID=$1
NODE_INSPECT_PORT=9229

kill -USR1 $PID
echo Waiting for inspector...
sleep 2

curl -s "http://localhost:$NODE_INSPECT_PORT/json" | jq -r ".[0].webSocketDebuggerUrl"

# Or use clinic.js for automated heap analysis:
# npx clinic heap -- node server.js

Prerequisites

  • Node.js >= 16
  • curl
  • jq

Pro Tips

  • → Open the .heapsnapshot in Chrome DevTools Memory tab.

Was this module useful?

Share your experience — it helps the team improve.

Leave Feedback

Commercial Licensing

Acquire a production access token or template license for enterprise deployment.

Module Info

Language
bash
Level
Advanced
Read time
3 min
Published
Feb 2026
License
Commercial License

Newsletter

New modules every week, directly to your inbox.