Today I learned:
How to kill rogue background Python processes
I started a simple Python http server as a background process at the end of a Python script. That was a mistake. Since it isn’t running in an open Terminal window, it is easy to forget about and it will run until you kill the process or reboot your machine. I don’t like that.
Here is how to identify and kill background Python processes in Terminal.app:
Run:
This will return something like this:
The second column is the PID. Make note of which one you want to kill. Then run:
Example. Let’s say I want to kill the python -m SimpleHTTPServer
process. I see that its PID is 74440. So I would run: