Skip to content

Instantly share code, notes, and snippets.

@nmccready
Created September 10, 2014 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmccready/b11c8cfb6eedde5ac82e to your computer and use it in GitHub Desktop.
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