Sitemap

Member-only story

Release Port on Linux

Aug 20, 2025

--

Often a process gets stuck to a port and you’d like to release the port. It happens to me sometimes when I am developing with NextJS or with other local servers that the process is running in the background and you don’t know which process is holding up the port you need for your new server.

Run the following command to find out the process Id that is holding up the port:

    sudo netstat -tulpn | grep :<port_number>
# or
sudo ss -tulpn | grep :<port_number>

Once you found out the process id, kill it with the following commnad:

kill -9 <PID>
  • 9 flag is to force it to terminate the process. You might have to add “sudo” if it is above your user’s permissions to kill the process.

Hope it helps.

--

--

Tech Explorer
Tech Explorer

Written by Tech Explorer

I love to developing applications to optimize business processes and solve problems that are impactful and valuable to businesses and community.