Skip to content

Instantly share code, notes, and snippets.

@jatin33
Last active June 1, 2020 07:47
Show Gist options
  • Save jatin33/0fb1d36eb8b4f0657c74bcaf1d0bc17d to your computer and use it in GitHub Desktop.
Save jatin33/0fb1d36eb8b4f0657c74bcaf1d0bc17d to your computer and use it in GitHub Desktop.
#!/bin/bash
echo Enter port number to kill
read port_number
pid="$(lsof -i:$port_number | awk '{ print $2 }' | sed -n 2p)"
kill -9 $pid
echo $?
@sladyn98
Copy link

sladyn98 commented Jun 1, 2020

Needed this :) Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment