Skip to content

Instantly share code, notes, and snippets.

View psheraton's full-sized avatar

Paul Sheraton psheraton

  • Seattle WA
View GitHub Profile
@psheraton
psheraton / kop.sh
Last active August 17, 2018 20:11
Kill on Port (OSX)
#!/bin/bash
# Kill a process that is listening on a port
PORT=$1
PID=$(lsof -i tcp:$PORT | grep LISTEN |tr -s ' ' | cut -d ' ' -f 2)
if [ $PID ]; then
kill $PID
fi