Skip to content

Instantly share code, notes, and snippets.

@mapix
Created May 16, 2013 06:56
Show Gist options
  • Select an option

  • Save mapix/5589885 to your computer and use it in GitHub Desktop.

Select an option

Save mapix/5589885 to your computer and use it in GitHub Desktop.
kill port
#!/bin/bash
port_prefix=`echo $1 | head -c -2`
for pid in `lsof -i | grep \:$port_prefix | awk '{print $2}'| uniq`; do
echo 'killing '${pid}
kill $pid || echo 'killing '${pid}' failed'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment