#!/bin/sh
#
# onport - show which process is using given tcp port

if [ "$#" -eq 0 ]; then
  printf '%s\n' "Usage: ${0##*/} [portnumber]" >&2
  exit 1
fi

port="$1"

case "$(uname)" in
  Darwin)
    lsof -i :"${port}"
    ;;
  *)
    netstat -tulpn | grep :"${port}"
    ;;
esac
