Last Updated: February 25, 2016
·
1.077K
· zohebsait

Kill process listening on a TCP port

Here's a tiny shell script I use to quickly kill of whatever process is hogging a TCP port.

$ cat portkill.sh
#!/bin/sh
lsof -i :$1 | awk '{print $2}' | tail -n 1 | xargs kill -9

Usage:
# kills process on port 8000
$ ./portkill.sh 8000

1 Response
Add your response

very handy!
can we get something like this for windows, and runs without admin rights?

over 1 year ago ·