I'm trying to get running processes from a linux server but I having some doubts. If I get top exit I have:
# top -b -n1 | head -n5
top - 16:18:19 up 60 days, 21:22, 8 users, load average: 0.03, 0.13, 0.15
Tasks: 1274 total, 7 running, 1267 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.6% us, 2.4% sy, 0.0% ni, 95.8% id, 0.1% wa, 0.0% hi, 0.0% si
Mem: 6291556k total, 5269044k used, 1022512k free, 29976k buffers
Swap: 6291448k total, 82508k used, 6208940k free, 649292k cached
What I want to know is which processed are the "7" that top says that are "running" in the second line.
I've try "ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm" and filter by "stat" status equal to "R" but I'm not able to get this 4 processes. I've always get the "ps and grep" and sometimes I get another one, but not not the seven tha ttop shows.
Is there any way to obtain that?
Thanks & regards.