Kurt Peek Kurt Peek - 1 month ago 9
Linux Question

How to determine which process is using a port in Linux

I'm currently running RethinkDB on its default port, because if I point my browser to

localhost:8080
I see the RethinkDB web interface:

enter image description here

I'd like to close RethinkDB and re-open it on another port using the
--port-offset
argument. However, so far I haven't been able to close it from within Python using the
conn.close()
method.

Instead, I'd like to try a brute-force approach by simply killing the process using that port. I tried to determine which process that is by using
netstat
, but that doesn't bring up any results:

kurt@kurt-ThinkPad:~$ netstat -a | grep 8080
kurt@kurt-ThinkPad:~$


How can I kill the RethinkDB process to make the port available again?

Answer
1.  lsof -i:8080
2.  kill $(lsof -t -i:8080)
or
2 . kill -9 $(lsof -t -i:8080)