tomvon
tomvon

Reputation: 5371

Kill all processes running on port 8080 on Mavericks

I'm getting a "socket.error: No socket could be created" when running a web.py script.

Is there a way to kill all processes on running on port 8080 (or any other port I wish) with a single line in Terminal on OSX Mavericks?

Upvotes: 3

Views: 7923

Answers (2)

Ashok Kumar
Ashok Kumar

Reputation: 403

The best way to kill all proccesses running on port 8080 in ubuntu is:

sudo fuser -k 8080/tcp

Upvotes: 1

Droppy
Droppy

Reputation: 9731

It's a single line, but you'd need to put it into a shell alias or shell script in order to make it easy to use:

$ kill $(lsof -i tcp:8080 | tail -n +2 | awk '{ print $2 }')

If you want to see and kill processes that don't belong to you, then sudo needs to get involved:

$ sudo kill $(sudo lsof -i tcp:8080 | tail -n +2 | awk '{ print $2 }')

Upvotes: 7

Related Questions