Skip to content

Instantly share code, notes, and snippets.

@yoshuawuyts
Created July 19, 2016 12:36
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoshuawuyts/31a1e863194a237e76afcc8b9fdcf4da to your computer and use it in GitHub Desktop.
Save yoshuawuyts/31a1e863194a237e76afcc8b9fdcf4da to your computer and use it in GitHub Desktop.
#!/bin/sh
#/ Usage: ports [<options>]
#/ Show processes listening on ports.
#/ Any <options> are passed to lsof
set -e
test "$1" = "--help" && {
grep ^#/ <"$0"| cut -c4-
exit 2
}
exec lsof -iTCP -sTCP:LISTEN -P "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment