If you get an error like [Errno 98] Address already in use when trying to run a service on a specific port in Ubuntu, you can find and free it.


Run process


inanzzz@inanzzz:/api$ mkdocs serve
[I 150813 16:22:39 server:271] Serving on http://127.0.0.1:8000

[Errno 98] Address already in use

Find and kill process


inanzzz@inanzzz:/api$ sudo netstat -lpn |grep :8000
tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN 5531/python

inanzzz@inanzzz:/api$ sudo kill -9 5531

Check it


inanzzz@inanzzz:/api$ sudo netstat -lpn |grep :8000
[1]+ Killed mkdocs serve