TL;DR

Three steps: ss -tlnp to list listeners, lsof -i :PORT to find the owner, ps -p PID -o pid,cmd to confirm before kill.

List Listeners

ActionCommand
All TCP listeners with processesss -tlnp
Filter by portss -tlnp 'sport = :8080'
Legacynetstat -tlnp
UDPss -ulnp

Find Processes

ActionCommand
Who owns the portlsof -i :8080
Find by namepgrep -f keyword
Process detailsps -p PID -o pid,user,cmd
Filter ps output`ps auxgrep keyword`

Handle Processes

ActionCommand
Graceful killkill PID
Force killkill -9 PID
Kill by namepkill -f keyword

Tips

Sources

最后更新:2026-08-02