Each time I need to stop the process that is occupying port 8080, I have to run this command first
$ lsof -i:8080
to get the PID
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
python 4024 ubuntu 3u IPv4 2181080 0t0 TCP *:http-alt (LISTEN)
and then I kill the PID
kill 4024
I'd like to write a script to make it simple, how do I extract the PID from the output of lsof -i:8080
?