Question: Reading the Output of Top

John G. Heim jheim at math.wisc.edu
Sat May 7 11:57:09 EDT 2016


The 2 main tools I use for overcoming challenges like this are hard work 
and determination.

But over this weekend, I think I'll try to find a few hours to put 
together some perl code to linearize output from a command line program. 
Perl is good for parsing output. I could use the perl module for taking 
single key input. I don't even remember what it's called, it's been so 
long since I used it. First draft would just break the columns down and 
allow you to move around the cells. Down arrow goes down a row. Left 
arro goes left. Etc.  I could really use a program like that myself. As 
bad as top is to listen to, try listening to the output from sar.





On 05/07/2016 06:24 AM, Parham Doustdar wrote:
>
> Hi John,
>
>     I doubt that there is an answer to your first question. You could
>     probably write a script to do it.
>
> Top is unusable without such a feature, but you and other people 
> replying to this thread seem to be using it just fine. So, what tricks 
> do people use in order to memorize what column is for what value? I 
> have this problem when reading the output of commands like |free -m|, too.
>
> Thanks!
>
> On 5/6/2016 6:00 PM, John G Heim wrote:
>
>> I doubt that there is an answer to your first question. You could 
>> probably write a script to do it.
>>
>> As for your second question, I run top thusly, 'top -bn1 | more'. 
>> This runs top in batch mode and has it retrieve the data just once. 
>> Piping the output to more keeps the data from scrolling off the top. 
>> What you get is a snapshot of the data at the moment you run the top 
>> command.
>>
>> PS: You can also set the refresh rate for top to something high 
>> enough for you to listen to the output.
>>
>>
>>
>> On 05/06/2016 01:59 AM, Parham Doustdar wrote:
>>> Hi all,
>>>
>>> What do you do when you want to read content of a command like 
>>> |top|? There are two issues with it:
>>>
>>> 1. There is no way of knowing the title of a column without first
>>>    navigating to the headers. I want to be able to go to the
>>>    next/previous column, know the title of a column, etc.
>>> 2. The output keeps changing. For example, while Iā€™m reading one line,
>>>    its CPU usage might drop and cause it to be reordered in the list.
>>>
>>> How do you get through these issues?
>>>
>>> Thanks!
>>>
>>> ā€‹
>>> _______________________________________________
>>> Speakup mailing list
>>> Speakup at linux-speakup.org
>>> http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup
>>
> ā€‹



More information about the Speakup mailing list