Created
August 13, 2024 14:16
-
-
Save patoi/b25ea4fa5c31ca5a2aac467483f972d1 to your computer and use it in GitHub Desktop.
MacOS list command's name by port
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
sudo lsof -iTCP -sTCP:LISTEN -n -P | awk 'NR>1 {print $9, $1, $2}' | sed 's/.*://' | while read port process pid; do echo "Port $port: $(ps -p $pid -o command= | sed 's/^-//') (PID: $pid)"; done | sort -n | |
# by Laurie Voss |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment