10
2
Usually to view individual cpu % we press '1' in the interactive mode of top.
However I am not able to figure out the logic to get the same output in batch mode i.e,
top -n1b
I am redirecting this output to a file to view it later and stuff like that, so I need the batch mode. Is it possible? Installing a separate tool for this is not gonna be possible.
I'm looking for an option that I am missing or some way to capture the output.
1The Q asks for batch mode. – Charles Stewart – 2010-01-25T09:49:59.370
2I'll try to be clearer: I know of no way on the command line to tell top "when you are in batch mode, print the individual cpu %". However, top does read
.toprc
in batch mode, so you can setup that file as I described, and then you'll get individual cpu % in batch mode as well. Or, at least it did for me (procps version 3.2.7) – jwhitlock – 2010-01-26T23:15:39.540does it have to be
top
? Why not useps
and sort on %CPU? I find %CPU misleading even, I tend to sort on VSIZE or RSS, because often what knocks my servers down are rogue memory hogs. – memnoch_proxy – 2010-01-31T06:04:20.290