Sample Header Ad - 728x90

How do I find number of vertical lines available in the terminal?

24 votes
2 answers
9322 views
I'm writing a script which shows the git log for a directory when I cd into it. Such a log can be overwhelming, containing hundreds of lines. So far I have been limiting that to a hard-coded 30 lines with (... | head -n 30), cool on the big screen at Work, too big at home. I would prefer the log to take up about half the (vertical) screen on any terminal, e.g. Gnome at work, iTerm2 at home. I do not use screen or tmux. But would like to learn them. How do I find the number of vertical lines available in a terminal from command line?
Asked by jalanb (598 rep)
Feb 10, 2015, 01:10 PM
Last activity: Feb 21, 2024, 03:44 AM