You can do:
ps -aux | awk '$14>=30000 && $14<=30100 && $0~/curl/ { print $2 }' | xargs kill -9
Based on your screenshot, port values appear on 14th column ($14 holds this value), putting a check of $0~/curl/
grabs only those lines with curl
effectively removing the need for grep
. print $2
prints the process id. We then pipe the output to xargs
and kill
.