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.

Advertisements

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 )

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s