Have you ever noticed that if you run rake -T in rails the list of rake descriptions are truncated by the width of the terminal window. So there should be a way to get it in Rub
def winsize
#Ruby 1.9.3 added 'io/console' to the standard library.
require 'io/console'
IO.console.winsize
rescue LoadError
# This works with older Ruby, but only with systems
# that have a tput(1) command, such as Unix clones.
[Integer(`tput li`), Integer(`tput co`)]
end
rows, cols = winsize
printf "%d rows by %d columns\n", rows, cols
Link