Skip to content

Instantly share code, notes, and snippets.

@cadrev
Created July 23, 2015 03:12
Show Gist options
  • Save cadrev/3f59c73aee5602529a25 to your computer and use it in GitHub Desktop.
Save cadrev/3f59c73aee5602529a25 to your computer and use it in GitHub Desktop.
find-and-kill-a-process-in-one-line-using-bash-and-regex
PORT_NUMBER=1234
lsof -i tcp:${PORT_NUMBER} | awk 'NR!=1 {print $2}' | xargs kill
kill $(ps aux | grep '[p]ython csp_build.py' | awk '{print $2}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment