Releasing ports in use in Linux

Have you ever experienced exiting out of an application and you can’t come back to it because the port is already in use. For example doing an iperf and accidentally pressing ctrl+C for some reason which takes you back to the command prompt.

Issuing the iperf -s command would give you an error message saying port is already in use.

Solution is to release the port with the use of lsof.

type: lsof -n -i

This will list down all your active ports and once you’ve found the port you’re after. Kill it with fuser so the format would be:

fuser -k /

Check the screenshot below.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s