Question: Reading the Output of Top

Willem van der Walt wvdwalt at csir.co.za
Thu May 12 01:31:16 EDT 2016


Hi John,
Thanks for this. I am about to try it now.
Regards, Willem


On Sat, 7 May 2016, John G. Heim wrote:

> Okay, I threw together a script to linearize table output from programs 
> like top. It's at:
> http://www.math.wisc.edu/~jheim/pub/linearize
>
> You can get it with wget:
>
> $ wget http://www.math.wisc.edu/~jheim/pub/linearize
>
> To run it, type linearize and your command after it. For example, to use 
> it with top, do this:
>
> linearize top -bn1
>
> The keys you have to use are configured at the top of the script. I had 
> to choose keys that would not interfere with speakup or orca so I picked 
> i to move up a line, the comma to move down a line, j to move left a 
> cell, and l to move right a cell. They form a little cross on the 
> keyboard. But you can easily change them to whatever you like by editing 
> the script. Let me know if you think there is a more logical set of keys 
> that don't interfere with other functions.
>
> One tricky thing. There is a key defined to set the column headings. 
> Press the h key and the script will use the current line for column 
> headings. Behaviour of the left and right keys is undefined until you do 
> this. So if you are using the script with top, you'd want to use the 
> comma to move down several times until you hear the first line of the 
> table listing processes. Then press the h key. From then on you can move 
> around as if you are in a table.
>
>
> 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
>>>
>> 
>
> _______________________________________________
> Speakup mailing list
> Speakup at linux-speakup.org
> http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup
>
> -- 
> This message is subject to the CSIR's copyright terms and conditions, e-mail 
> legal notice, and implemented Open Document Format (ODF) standard. 
> The full disclaimer details can be found at 
> http://www.csir.co.za/disclaimer.html.
>
> This message has been scanned for viruses and dangerous content by 
> MailScanner, 
> and is believed to be clean.
>
> Please consider the environment before printing this email.
>
>


More information about the Speakup mailing list