Skip to content

Instantly share code, notes, and snippets.

@jakelogemann
Created June 9, 2014 21:30
Show Gist options
  • Save jakelogemann/af7bbc5ab7e1ee1b7139 to your computer and use it in GitHub Desktop.
Save jakelogemann/af7bbc5ab7e1ee1b7139 to your computer and use it in GitHub Desktop.
Check Connections To Port
#!/bin/bash
# Lists connections on a given port, defaults to 80
PORT=${1:-80}
clear
while x=0; do
clear;
echo "Connections to $HOSTNAME:$PORT"
echo "[Updated: $(date)]";
echo "==============================";
echo "";
netstat -np|grep :$PORT|grep -v LISTEN|awk '{print $5}'|cut -d: -f1|uniq -c;
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment