Created
August 13, 2024 01:05
-
-
Save dims/d8069b1c27409f9130f815bc6075ee2d to your computer and use it in GitHub Desktop.
Shows the name of the command running on each port on MacOS
This file contains hidden or 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment