Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

I typed man top and read about top -i which displays non-idle, non-zombie processes.

share|improve this answer
    
thanks a lot! Thats exactly what I wanted! –  magiza83 Oct 16 '12 at 14:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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