How to determine which process is using a port in Linux
<p>I'm currently running RethinkDB on its default port, because if I point my browser to <code>localhost:8080</code> I see the RethinkDB web interface:</p>

<p><a href="http://i.stack.imgur.com/vtGXl.png" rel="nofollow"><img src="http://i.stack.imgur.com/vtGXl.png" alt="enter image description here"></a></p>

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

<p>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 <code>netstat</code>, but that doesn't bring up any results:</p>

<pre><code>kurt@kurt-ThinkPad:~$ netstat -a | grep 8080
kurt@kurt-ThinkPad:~$ 
</code></pre>

<p>How can I kill the RethinkDB process to make the port available again?</p>

<pre><code>1.  lsof -i:8080
2.  kill $(lsof -t -i:8080)
or
2 . kill -9 $(lsof -t -i:8080)
</code></pre>

python linux rethinkdb