[Linux] bulk deletion job

When accidentally cast a giant multi-tasking, or delivery of resources is unreasonable, I want to kill the bulk of these tasks.
image.png

kill method is not to say, I use qdel way.
With such a single command:

 qstat |sed '1,2d' |awk -F' ' '{print $1}' |sed ':x;N;s/\n/ /;b x'|cat

image.png

And then qdeldelete it. Here it is a two-step, and with sedthe replacement line breaks with spaces look very complex, unfriendly.
image.png

In fact, it can be directly used xargsto simplify:

qstat |sed '1,2d' |awk -F' ' '{print $1}' | xargs qdel

image.png

May also be selectively deleted by the user or the operating state, such as a task only deleted without deleting the task wait state operation.

qstat -u USERNAME | grep "qw" | cut -d" " -f1 | xargs qdel

image.png
Also, delete tasks running:

qstat -u USERNAME | grep "r" | cut -d" " -f1 | xargs qdel

cutAnd awkcan

Guess you like

Origin www.cnblogs.com/jessepeng/p/11361239.html