Skip to content

Instantly share code, notes, and snippets.

@jvik
Created May 28, 2019 14:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jvik/fc85f01c66889ca905a09f1e9b895974 to your computer and use it in GitHub Desktop.
Save jvik/fc85f01c66889ca905a09f1e9b895974 to your computer and use it in GitHub Desktop.
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