Reputation: 1349
Given an alias that lists last modified files, like this:
alias lt='ls -ltc|head -10'
is there a way to determine the lines displayable so I could have a filter/limit that is a function of that.
Not concerned about other issues like line-wrapping etc.
Upvotes: 1
Views: 610
Reputation: 19475
The number of lines displayable on the current terminal is available in the $LINES
variable.
Upvotes: 3
Reputation: 74078
You can get the terminal's size with:
stty size
which responds with number of rows and columns, e.g.:
25 80
And
stty size | awk '{print $1;}'
would give you just the number of lines.
Upvotes: 2