Skip to content

Instantly share code, notes, and snippets.

@geunho
Created August 25, 2019 11:04
Show Gist options
  • Save geunho/28609fda1c70f28779d51ce55ed9c9cc to your computer and use it in GitHub Desktop.
Save geunho/28609fda1c70f28779d51ce55ed9c9cc 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
}
#from https://stackoverflow.com/questions/4421633/who-is-listening-on-a-given-tcp-port-on-mac-os-x/30029855#30029855
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment