About me I've been a computer programmer since I first started typing in program listings on a Commodore Vic 20 when I was about 8. My hobbies include electronics, CNC manufacturing, photography, beer and winemaking.
I live with my wife and lots of left-over parts from unfinished projects in Lincoln, Nebraska, USA.]
Blog
19 February 2012, 16:54 UTCsorttop: show the biggest values as a program runs
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.
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 "du -h" work as expected), and shows the top items
read so far. Example usage: du -hx / | python sorttop.py
Update, Feb 20, 2012: Revised the script to work for more terminals;
fixes a traceback on the line 'bol = curses.tparm(ti_hpa, 0)' when TERM=screen.
Files currently attached to this page:
sorttop.py 3.3kB
sorttop: show the biggest values as a program runs
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.
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 "du -h" work as expected), and shows the top items read so far. Example usage: du -hx / | python sorttop.py
Update, Feb 20, 2012: Revised the script to work for more terminals; fixes a traceback on the line 'bol = curses.tparm(ti_hpa, 0)' when TERM=screen.
Files currently attached to this page:
| sorttop.py | 3.3kB |
All older entries
Website Copyright © 2004-2024 Jeff Epler