Search code examples
localhostports

Localhost port 8000 and 8888 redirect to 8080


I can't track down what's forcing localhost:8000 and localhost:8888 to redirect to localhost:8080. Is there anyone out there that has an idea? I'm on a local machine, mac os x, not a server. I've used jekyll, pow, haproxy, nodejs, webrick, and mamp. Right now none of them are running (as far as I know).


Solution

  • Here's a bash script that will kill the process running on a specific port.

    lsof -n -i4TCP:3000 | grep LISTEN | tr -s ' ' | cut -f 2 -d ' ' | xargs kill -9
    

    Just replace 3000 with the desired port you'd like to kill.

    This should clear all your ports for you:

    lsof -n -i4TCP:8080 | grep LISTEN | tr -s ' ' | cut -f 2 -d ' ' | xargs kill -9
    lsof -n -i4TCP:8888 | grep LISTEN | tr -s ' ' | cut -f 2 -d ' ' | xargs kill -9
    lsof -n -i4TCP:8000 | grep LISTEN | tr -s ' ' | cut -f 2 -d ' ' | xargs kill -9