Kill what ever is running on port 8080

16

10

I am trying to run a GAE app on localhost:8080, but it was apparently occupied, even after shutting down and restarting my computer. I ran sudo lsof -i :8080. Lo and behold there is something sill running with PID 66. What can I do to kill that process and free up 8080 again?

EasilyBaffled

Posted 2013-06-20T00:29:23.077

Reputation: 379

Answers

5

Turns out it's just kill -9 PID, you might need sudo. Found the answer on maclife.com in the article Terminal 101: Track and Kill Processes.

EasilyBaffled

Posted 2013-06-20T00:29:23.077

Reputation: 379

8

  1. Find out what Process ID (pid) is using the required port (e.g port 5434).

    ps aux | grep 5434
    
  2. Kill that process:

    kill -9 <pid>
    

Ashutosh Gupta

Posted 2013-06-20T00:29:23.077

Reputation: 81

1

See also When should I not kill -9 a process?

– Arjan – 2015-07-31T12:08:51.707

What in the output of the first command is the pid? – shim – 2019-10-17T15:03:40.363

7

lsof -i @localhost:8080

kill -9 <<PID>>

twhoward99

Posted 2013-06-20T00:29:23.077

Reputation: 181

While this may work, it repeats what the OP posted and could use an explanation. – bertieb – 2015-09-24T14:30:53.147

This answer is the most clear and has best feedback in terminal! ps aux | grep 5434 doesn't say at all which is the PID!! – mesqueeb – 2018-10-04T08:03:27.757

Nothing happens when I enter lsof -i @localhost:8080 – shim – 2019-10-17T15:03:22.480

3

Merging answers from above in one line: kill $(lsof -t -i:8080)

lsof -t returns the PID and passes that to kill.

Prashant

Posted 2013-06-20T00:29:23.077

Reputation: 1 013