I ran a simple web server using
python -m simpleHTTPServer 8888 &.
it starts well. Then used ctrl+C to attempt to terminate it, and I go to
http://localhost:8888/
and the server is still running. Am I doing something wrong?
I am using zsh for terminal, not sure if this has anything to do with it.
It’s because of the &
that causes the command to be run in background. After you started the process, you get the process id. Using that id, you can kill
the process:
$ python &
[1] 5050
$ kill -15 5050
[1]+ Angehalten python
If sending a SIGTERM
signal (-15
) does not work, you can use SIGKILL
(-9
).
Edited to use SIGTERM
instead of SIGKILL
, see @starrify’s comment.