Skip to content

Instantly share code, notes, and snippets.

@mig82
Forked from evanscottgray/portfinders.zsh
Created December 15, 2021 18:39
Show Gist options
  • Save mig82/32782e3dd36357eca79c3fded6e11be8 to your computer and use it in GitHub Desktop.
Save mig82/32782e3dd36357eca79c3fded6e11be8 to your computer and use it in GitHub Desktop.
put this in your $shellrc and enjoy
# Find ALL the port users. _o/
findbyport() {
lsof -nP | grep ":$@" | awk '{print "Program: " $1 "\n" "PID: "$2 "\n" "User: " $3 "\n" "Address: "$9 "\n" "Action: " $10}'
}
portsinuse() {
lsof -nP | grep "IPv" | while read line; do echo $line | awk '{print "Program: " $1 "\n" "PID: "$2 "\n" "User: " $3 "\n" "Address: "$9 "\n" "Action: " $10}'; echo; done;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment