Skip to content

Instantly share code, notes, and snippets.

@shospodarets
Last active August 5, 2016 14:04
Show Gist options
  • Save shospodarets/b839369cabb16a6d49a98cfba58fcbe8 to your computer and use it in GitHub Desktop.
Save shospodarets/b839369cabb16a6d49a98cfba58fcbe8 to your computer and use it in GitHub Desktop.
Script to kill all the processes which established connection to the port.Usage: './checkport.sh 35729' (clear the livereload port)
#!/usr/bin/env bash
function terminate {
echo ':'$1
lsof -P | grep ':'$1 | awk '{print $2}' | xargs kill -9
}
terminate $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment