Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash - killall -r does not match

I have many processes with similar names, like "proc_1asd, proc_2wqe, proc_3zxc"

I need to send a non-brutal interruption signal to them all, pkill -f would work, but it's not installed.

I'm trying to use killall -r proc_*, but I get this error

proc_*: no process found

I have the impression I'm doing something extremely stupid, but I don't know what.

Here's an image (actual name of the processes is jnode_something)

Task manager screenshot

pgrep -lf 'proc_.*' returns

15070 jnode_0 -cp lib/xstream-1.4.7.jar:build/classes sandbox.GridNode Configs/0_config.txt Logs
15071 jnode_1 -cp lib/xstream-1.4.7.jar:build/classes sandbox.GridNode Configs/1_config.txt Logs
15072 jnode_2 -cp lib/xstream-1.4.7.jar:build/classes sandbox.GridNode Configs/2_config.txt Logs
15073 jnode_3 -cp lib/xstream-1.4.7.jar:build/classes sandbox.GridNode Configs/3_config.txt Logs
15074 jnode_4 -cp lib/xstream-1.4.7.jar:build/classes sandbox.GridNode Configs/4_config.txt Logs
like image 759
Agostino Avatar asked Mar 21 '23 08:03

Agostino


1 Answers

Seems like overkill, but if you can get the PIDs from pgrep, just use them as arguments to kill. Something like:

pgrep -lf 'proc_.*' | awk '{print $1}' | xargs kill -f
like image 179
problemPotato Avatar answered Apr 05 '23 23:04

problemPotato