Last active
June 1, 2020 07:47
-
-
Save jatin33/0fb1d36eb8b4f0657c74bcaf1d0bc17d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to run it?
./killProcessOnPort.sh
Terminal will ask you the port number to kill.