Linux Signals and Job Control/Terminate port owners with lsof and xargs

Combine lsof and xargs to terminate port users.

Section: Batch Termination Patterns

Terminate port owners with lsof and xargs

bash
bash
lsof -ti :3000 | xargs -r -n1 kill -TERM
Explanation

Combine lsof and xargs to terminate port users.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Batch Termination Patterns
Kill exact process name
Only match an exact process name.
OpenIn sheetbashsame section
Kill by parent PID
Signal all child processes of a parent.
OpenIn sheetbashsame section
Kill all by user and name
Limit killall by user and executable name.
OpenIn sheetbashsame section
Kill using regex
Use a regex pattern with killall where supported.
OpenIn sheetbashsame section
Signal a process group
Signal every process in a process group.
OpenIn sheetbash1 tag match
Test whether PID exists
Check whether a process exists and whether you can signal it.
OpenIn sheetbash1 tag match