Skip to content

Instantly share code, notes, and snippets.

@nmccready
Created September 10, 2014 00:41
Show Gist options
  • Select an option

  • Save nmccready/b11c8cfb6eedde5ac82e to your computer and use it in GitHub Desktop.

Select an option

Save nmccready/b11c8cfb6eedde5ac82e to your computer and use it in GitHub Desktop.
example of using lsof and awk to get just a pid of a running process on a specific port.
#!/bin/sh
port=${1:-8000}
lsof -i:$port | grep -v PID | awk '{print $2}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment