Hot answers tagged


You can do this by grepping the line beginning with "Cpu(s)" and piping the result through tail. top -b -n2 -d 0.1 |grep "Cpu(s)"|tail -n +1 The tail -n +1 discards the first line (the bad results) and only lets the second line through. The -d 0.1 means a delay of one-tenth of a second between the first and second iteration of top; -b -n2 means run twice ...

Only top voted, non community-wiki answers of a minimum length are eligible