Freeing up a TCP/IP port?

bapi picture bapi · Apr 15, 2009 · Viewed 303.1k times · Source

netstat -tulnap shows me what ports are in use. How to free up a port in Linux?

Answer

uzi picture uzi · Apr 15, 2009

As the others have said, you'll have to kill all processes that are listening on that port. The easiest way to do that would be to use the fuser(1) command. For example, to see all of the processes listening for http requests on port 80 (run as root or use sudo):

# fuser 80/tcp

If you want to kill them, then just add the -k option.