Created
September 10, 2014 00:41
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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