Kill process listening on a TCP port
Published in
1 min readNov 2, 2016
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