Skip to content

Instantly share code, notes, and snippets.

@radub
Created February 12, 2021 13:54
Show Gist options
  • Save radub/0205ebb9c749eecf45506b3ad3878de0 to your computer and use it in GitHub Desktop.
Save radub/0205ebb9c749eecf45506b3ad3878de0 to your computer and use it in GitHub Desktop.
# who is listening on port xxxx
listening() {
if [ $# -eq 0 ]; then
sudo lsof -iTCP -sTCP:LISTEN -n -P
elif [ $# -eq 1 ]; then
sudo lsof -iTCP -sTCP:LISTEN -n -P | grep -i --color $1
else
echo "Usage: listening [pattern]"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment