Skip to content

Instantly share code, notes, and snippets.

@dillonstreator
Last active October 7, 2021 01:01
Show Gist options
  • Save dillonstreator/358e3e5172c48fd59d86b68655a787a3 to your computer and use it in GitHub Desktop.
Save dillonstreator/358e3e5172c48fd59d86b68655a787a3 to your computer and use it in GitHub Desktop.
find PID running on a port utility shell function

Find PID running on a port

# .zshrc

port-to-pid() {
        lsof -i:$1 -Fp | sed 's/^p//' | head -n 1
}
port-to-pid 3000

# {PID}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment