<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#">
<link rel="alternate" type="text/html" href="https://gamma.unpythonic.net/"/>

<title>Jeff Epler's blog</title>
<modified>2012-02-19T16:54:33Z</modified>
<tagline>Photos, electronics, cnc, and more</tagline>
<author><name>Jeff Epler</name><email>jepler@unpythonic.net</email></author>
<entry>
<title>sorttop: show the biggest values as a program runs</title>
<issued>2012-02-19T16:54:33Z</issued>
<modified>2012-02-19T16:54:33Z</modified>
<id>https://gamma.unpythonic.net/01329670473</id>
<link rel="alternate" type="text/html" href="https://gamma.unpythonic.net/01329670473"/>
<content type="text/html" mode="escaped">
When I am looking for big disk users, I don't care about all the little items.
What would be great is to continuously see the biggest items encountered so
far.

&lt;p&gt;To this end, I've written a Python program I call 'sorttop'; it continually
reads stdin, sorts the first column according to magic (i.e., human numbers like from &amp;quot;du -h&amp;quot; work as expected), and shows the top items
read so far.  Example usage: &lt;tt&gt;du -hx / | python sorttop.py&lt;/tt&gt;

&lt;p&gt;&lt;b&gt;Update, Feb 20, 2012&lt;/b&gt;: Revised the script to work for more terminals;
fixes a traceback on the line 'bol = curses.tparm(ti_hpa, 0)' when TERM=screen.

&lt;p&gt;&lt;p&gt;&lt;b&gt;Files currently attached to this page:&lt;/b&gt;
&lt;table cellpadding=5 style=&quot;width:auto!important; clear:none!important&quot;&gt;&lt;col&gt;&lt;col style=&quot;text-align: right&quot;&gt;&lt;tr bgcolor=#eeeeee&gt;&lt;td&gt;&lt;a href=&quot;https://media.unpythonic.net/emergent-files/01329670473/sorttop.py&quot;&gt;sorttop.py&lt;/a&gt;&lt;/td&gt;&lt;td&gt;3.3kB&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p&gt;</content>
</entry>
</feed>
