Skip to content

Instantly share code, notes, and snippets.

@scolton99
Created December 17, 2025 13:20
Show Gist options
  • Select an option

  • Save scolton99/2fc28a879a84cda3845f389be64d5a14 to your computer and use it in GitHub Desktop.

Select an option

Save scolton99/2fc28a879a84cda3845f389be64d5a14 to your computer and use it in GitHub Desktop.
Test TCP port (headless)
#!/bin/bash
HOST=fqdn.example.com
PORT=8000
nc -z -w 5 "$HOST" "$PORT" && echo "Do this if the port is OPEN" || echo "Do this if the port is CLOSED"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment