Kill what ever is running on port 8080
Solution 1
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.
Solution 2
-
Find out what Process ID (pid) is using the required port (e.g port
5434
).ps aux | grep 5434
-
Kill that process:
kill -9 <pid>
Solution 3
lsof -i @localhost:8080
kill -9 <<PID>>
Solution 4
Merging answers from above in one line: kill $(lsof -t -i:8080)
lsof -t
returns the PID and passes that to kill
.
Solution 5
Use the following command to find the process ID of the process running on the desired port:
$ netstat -ano | findstr :8080
The result will be displayed as:
$ netstat -ano | findstr :5000
TCP 0.0.0.0:5000 0.0.0.0:0 LISTENING 18024
Here, 18024 is the PID or Process ID.
Then use the following command to kill the process on the post 8080:
$ taskkill /PID 18024 /F
or:
$ taskkill //PID 18024 //F
Result will be displayed as:
$ taskkill //PID 18024 //F
SUCCESS: The process with PID 18024 has been terminated.
Related videos on Youtube
EasilyBaffled
Updated on September 18, 2022Comments
-
EasilyBaffled over 1 year
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 ransudo 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? -
Arjan almost 9 yearsSee also When should I not kill -9 a process?
-
bertieb over 8 yearsWhile this may work, it repeats what the OP posted and could use an explanation.
-
mesqueeb over 5 yearsThis answer is the most clear and has best feedback in terminal!
ps aux | grep 5434
doesn't say at all which is the PID!! -
shim over 4 yearsNothing happens when I enter
lsof -i @localhost:8080
-
shim over 4 yearsWhat in the output of the first command is the
pid
? -
Admin about 2 yearskill: not enough arguments