# Created on savesnippets.com ยท https://savesnippets.com/KodHf7ew8AMZYb # Find what owns port 8080 lsof -ti :8080 # just PIDs (good for piping) lsof -i :8080 # full info (PID, user, command, etc.) # Same with ss (no lsof install needed on modern distros) ss -tlnp 'sport = :8080' # Kill whoever holds it kill "$(lsof -ti :8080)" # SIGTERM kill -9 "$(lsof -ti :8080)" # SIGKILL (use only if SIGTERM ignored) # Helper killport() { local pids pids="$(lsof -ti ":$1")" || { echo "Nothing on port $1"; return 1; } kill "$pids" echo "killed PIDs: $pids" } killport 3000