CLI Basics for Node
10 examples for curl, jq, ss, and log tailing on Linux servers running Node.js APIs - 7 basic and 3 intermediate.
Search across all documentation pages
10 examples for curl, jq, ss, and log tailing on Linux servers running Node.js APIs - 7 basic and 3 intermediate.
curl, jq, and ss installed (default on most Linux images).3000 default) and health route (/health).curl -sf http://localhost:3000/health
curl -sf http://localhost:3000/ready-s silent, -f fail on HTTP 4xx/5xx (non-zero exit)ready should fail when Postgres/Redis unreachable# With timing for latency triage
curl -sf -w "time_total=%{time_total}\n" -o /dev/null http://localhost:3000/healthcurl -sf -X POST http://localhost:3000/orders \
-H "Content-Type: application/json" \
-H "x-request-id: cli-smoke-$(date +%s)" \
-d '{"customerId":"550e8400-e29b-41d4-a716-446655440000","items":[{"sku":"550e8400-e29b-41d4-a716-446655440001","quantity":1}]}'x-request-id for log correlationjq for readable output: | jq .# Last 100 error lines from container stdout
kubectl logs deploy/orders-api --tail=500 | jq -c 'select(.level=="error")' | tail -20
# Trace one request
kubectl logs deploy/orders-api --since=10m | jq -c 'select(.requestId=="abc-123")'jqselect(.statusCode >= 500) for HTTP errors in request_complete eventsRelated: pino - log field conventions
ss -tlnp | grep node
ss -tlnp 'sport = :3000'ss replaces deprecated netstat on modern Linux0.0.0.0:3000, not 127.0.0.1 only in containersss -ssudo journalctl -u orders-api -f --since "15 min ago"
sudo journalctl -u orders-api -p err --since today-f follow live logs on VMs without Kubernetessystemctl status orders-api for restart loopsdocker logs -f --tail 200 orders-api
docker logs orders-api 2>&1 | jq -c 'select(.level=="error")' | tail -10docker exec to read log files that do not existcurl -sf https://api.stripe.com/v1/charges -H "Authorization: Bearer sk_test_xxx" -o /dev/null -w "%{http_code}\n"
getent hosts postgres.internal#!/usr/bin/env bash
set -euo pipefail
BASE_URL="${BASE_URL:-http://localhost:3000}"
curl -sf "$BASE_URL/health" | jq -e '.status == "ok"'
curl -sf "$BASE_URL/ready" | jq -e '.status == "ok"'
echo "smoke OK"bin/smoke.sh; run post-deploy in CI or SSHset -euo pipefail fails fast on first errorRelated: Linux CLI Best Practices - script hygiene
curl -sI http://localhost:3000/orders/1 | grep -iE 'cache-control|x-request-id|content-type'-I HEAD request for metadata onlyfor i in $(seq 1 20); do
curl -sf -o /dev/null -w "%{http_code} %{time_total}\n" http://localhost:3000/health
donek6 or autocannon, not bash loops in productionRun from bastion or debug pod with jq. Alternatively node -e parse JSON, but jq is faster for ops.
Expected - production is behind VPN or private network. SSH to bastion or kubectl port-forward first.
Stack versions: This page was written for Node.js 24.18.0 (Active LTS), npm 10+, TypeScript 5.6+, Express 5, Fastify 5, and NestJS 11.
Reviewed by Chris St. John·Last updated Jul 16, 2026