Skip to content
Advertisement

How to get the process status only with “R” in linux?

–Need to get the status of the background running script.

Initially, I ran the script and terminated it turned to stat “T” enter image description here

further, running the same script but while grep getting the script with stat “T”and “R” enter image description here

Here, how to get the process with only “R”. here is the command used

ps aux | grep test.sh | grep -v grep

Advertisement

Answer

Using :

ps aux | awk '$7 == "R+"' 
Advertisement