Hello everyone!

We have been investing plenty of personal time and energy for many years to share our knowledge with you all. However, we now need your help to keep this blog running. All you have to do is just click one of the adverts on the site, otherwise it will sadly be taken down due to hosting etc. costs. Thank you.

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

[Errno 98] Address already in use

Find and kill process

inanzzz@inanzzz:/api$ sudo netstat -lpn |grep :8000
tcp 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

Find and kill process by name

If you wish to find a process by its name and kill it then you can use command below. Assume that your command is running as $ bin/auth in terminal.

inanzzz@inanzzz:/api$ ps aux | grep -i bin/auth | awk {'print $2'} | xargs kill -9