Created
July 29, 2022 22:01
-
-
Save kgriffs/95ad28532f29cd5767585e99343cf5d8 to your computer and use it in GitHub Desktop.
macOS port listening bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/a/30029855/21784 | |
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