You can kill a process by:
knowing process name
pkill process-name
or
ps au | grep process-name
kill process-id
clicking on process window
xkill
knowing a port number that is blocked by the process
using npm cli tool
npx cross-port-killer 4321
using lsof utility
kill $(lsof -t -i:4321)
or more fancy way with fzf and unix fu
portkill() {
local pid
# get processes listening on local numbered ports and output process id, port number and process name
pid=$( \
netstat -tnlp 2>/dev/null \
| awk 'BEGIN { OFS = "\t"; print "PID","PORT","NAME" } $4 ~ "(127.0.0.1\|\[::\]\|0.0.0.0):[0-9]" && $7!="-" { gsub(/:::/,":"); split($7,a,"/"); split($4,b,":"); print a[1],b[2],a[2] }' 2>/dev/null \
| sort -n -k2 \
| fzf \
| awk '{ print $1 }' \
)
if [ "x$pid" != "x" ]; then
echo $pid | xargs kill -${1:-9}
echo "Process $pid was killed"
else
echo "No process was killed"
fi
}