Tech Tip: Create an Automatically Scrolling Reader
By combining three useful command-line tools (less, watch and xdotool) along with two xterm windows, you can create an automatically scrolling reader.
Say you have a good book in text-file form ('book.txt') that you just downloaded from Project Gutenberg.
Open one xterm and do the usual thing you do when you want to read
that book with less:
$ less book.txt
Look at the first few characters in the title line of that xterm's
window. (In mine, it was bzimmerly@zt, which is my user ID and the name
of the machine I was working on.)
Open another xterm, issue this command, and watch (pun intended) the magic:
$ watch -n 1 xdotool search --name bzimmerly@zt key ctrl+m
The watch command will (every second) issue a
"Return" (Ctrl-m)
keystroke to the window that has "bzimmerly@zt" as a title,
and it will
stop only when you interrupt it with Ctrl-c! I think this is neato
daddyo! (What can I say? I'm a child of the '60s!)
Trending Topics
| Calculating Day of the Week | May 30, 2012 |
| Hack and / - Password Cracking with GPUs, Part II: Get Cracking | May 29, 2012 |
| Networking Poll | May 29, 2012 |
| OpenLDAP Everywhere Reloaded, Part I | May 23, 2012 |
| Chemistry the Gromacs Way | May 21, 2012 |
| Make TV Awesome with Bluecop | May 16, 2012 |
- Hack and / - Temper Temper
- Calculating Day of the Week
- Hack and / - Password Cracking with GPUs, Part II: Get Cracking
- Validate an E-Mail Address with PHP, the Right Way
- OpenLDAP Everywhere Reloaded, Part I
- RSS Feeds
- Hack and / - Password Cracking with GPUs, Part I: the Setup
- Networking Poll
- Tales From the Server Room: Zoning Out
- Boot with GRUB
- Really nice :-)
Something
3 hours 52 min ago - Have you experimented with
3 hours 54 min ago - Awesome..
4 hours 16 min ago - Good One..
4 hours 34 min ago - Nice One...
4 hours 38 min ago - very good web: ---(
4 hours 42 min ago - very good web: ---(
4 hours 48 min ago - very good web: ---(
4 hours 50 min ago - very good web: ---(
4 hours 54 min ago - very good web: ---(
4 hours 56 min ago





Comments
Scrolling Reader using tabs
Worked fine for me under using Ubuntu 10.10 (Meerkat), so I tried using tabs - one for the document, a second for the command. Start it then click on the document tab and scrolling starts. To pause it, click on the command tab which then receives (but ignores) the "Return"s. Click the document tab to resume lazy reading.
Note, however, that if you have another terminal window open with the same title line it will send to that.
Error opening terminal: xterm-256color
how do we go about installing the necessary terminfo files then?
hmmpf. all I get in the
hmmpf. all I get in the second xterm is a ">"
Thanks for sharing
it looks cool to give a try will be back after making and experiment with this