Skip to content

Instantly share code, notes, and snippets.

@layerok
Created September 21, 2024 19:23
Show Gist options
  • Save layerok/ed9f72829049cad720bb8495cb971e62 to your computer and use it in GitHub Desktop.
Save layerok/ed9f72829049cad720bb8495cb971e62 to your computer and use it in GitHub Desktop.
~/.zshrc or ~/.bash_profile
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