Search this Website

 

Ubuntu

UNIX

top command

Category: UNIX-Unix Beginner

top command

hey,
using one single line of command i am trying to show the cpu usage for 4 processors and then filter it out and write it to a text file. everything seams ok except that i am not able to switch from having the top command show me all cpu processes seperate opposed to showing me the average of all 4.
i know once i go into top, i can toggle that option by hitting the '1' key. however, i would like to have one command that does this.

i've looked into different configurations files as well but no luck. any ideas or help would be appreciated. thanck you

georges a a

ex:

top -n 1 | cat | head -6 | tail -3 | tr -cs 'a-z',.,'0-9' '\n' | sed '1,8d' | sed '2,8d' | sed '3,9d'> /output.txt

this commmand will get and filter the cpu process and write it to a text file. however, this is only displaying the average of all 4.