This question already has an answer here:

I want to keep monitoring a specific job on a slurm worload like cluster. I tried to use the watch command and grep the specific id. If the job id is4138, I tried

$> watch squeue -u mnyber004 | grep 4138
$> squeue -u mnyber004 | watch grep 4138

but they doesn't work. The second command works for the first few seconds, but stop working when watch refreshes.

A better idea please?

marked as duplicate by DopeGhoti, heemayl, Jeff Schaller, ilkkachu, Stéphane Chazelas linux Aug 27 '18 at 21:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


You have to quote the command

watch 'squeue -u mnyber004 | grep 4138'

The other answer covers how to handle using the 'watch' utility with a pipe but since you're using Slurm and know the job ID, just ask Slurm for that job's status:

$> watch squeue -j 4138

Not the answer you're looking for? Browse other questions tagged or ask your own question.