As a longtime UNIX (of the macOS variety) / Linux user, it’s kind of embarrassing that only recently I was made aware of this single command (or rather – in a true UNIX fashion: a composition of two commands) that allows you to stop a UNIX process running under a specific TCP port (e.g., a Spring Boot application or an Angular front-end during development) – rather than browsing for that port in a process list first and then manually using the process’s ID for issuing a subsequent kill
command:
1 | kill $(lsof -t -i:8080) |
explainshell.com has an article that explains this command and its components quite nicely in a lot more detail.