Network and internet

Find and stop what's using a port

For when you see "address already in use" or "port 3000 is already taken".

Fill these in once
  1. See what's using the port
    Terminal
    lsof -i :3000
  2. Stop it
    Terminal
    kill -9 $(lsof -ti :3000)
  1. See what's using the port
    Terminal · Ubuntu / Debian
    lsof -i :3000

    Nothing listed? It may belong to another user or a system service. Put sudo in front of both commands.

  2. Stop it
    Terminal · Ubuntu / Debian
    fuser -k 3000/tcp
  1. See what's using the port
    PowerShell
    Get-Process -Id (Get-NetTCPConnection -LocalPort 3000 -State Listen).OwningProcess
  2. Stop it
    PowerShell
    Get-NetTCPConnection -LocalPort 3000 -State Listen | Select-Object -ExpandProperty OwningProcess -Unique | ForEach-Object { Stop-Process -Id $_ -Force }