Skip to content

Instantly share code, notes, and snippets.

@evanscottgray
Created January 14, 2015 00:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save evanscottgray/75b940e8ec0bc71fc48d to your computer and use it in GitHub Desktop.
Save evanscottgray/75b940e8ec0bc71fc48d 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