On a bash console, if I do this:
cd mydir ls -l > mydir.txt
The > operator captures the standard input and redirects it to a file; so I
Use hirb. It automatically pages any output in irb that is longer than a screenful. Put this in a console session to see this work:
>> require 'rubygems' >> require 'hirb' >> Hirb.enable
For more on how this works, read this post.