Skip to content

Instantly share code, notes, and snippets.

@IsmiKin
Created February 12, 2020 13:39
Show Gist options
  • Save IsmiKin/0457126afb4f2013b3b218e6edcc44bd to your computer and use it in GitHub Desktop.
Save IsmiKin/0457126afb4f2013b3b218e6edcc44bd to your computer and use it in GitHub Desktop.
Kill process by port
lsof -i:3001 -Fp | head -n 1 | sed 's/^p//' | xargs kill
alias kbp='killByPort'
killByPort() {
lsof -i:$1 -Fp | head -n 1 | sed 's/^p//' | xargs kill
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment