Glimpse, a missing Unix Command

Here is a Unix command I often yearn for.  Let’s call it glimpse.  You put it into a pipeline and it provides a glimpse of what’s happening in that pipeline.  In it’s simplest form it would work just use termcap to show what’s happening; overwriting a single line in the terminal with the lines flowing thru the pipeline.  If a window system was to be found it could pop up a transient window showing a bit of what’s flowing past.  Extra points for charting, progress displays, filtering, etc.

I have a very primitive version:

#!/bin/sh
trap 'rm -rf /tmp/glimpse.$$*' EXIT
FIFO=/tmp/glimpse.$$.fifo
mkfifo $FIFO
xterm -title glimpse -fg blue -e sh -c "cat $FIFO ; sleep 30" &
tee $FIFO

Which presumes you have X11 at hand. This has the advantage that it will work across ssh connections.  For example: tail -f /var/log/messages | glimpse > /dev/null

Update: pv mentioned in the comments is sweet!  Thanks Ted!

1 thought on “Glimpse, a missing Unix Command

Leave a Reply

Your email address will not be published. Required fields are marked *