find out the size of open terminal
If you issue the command
stty size
it returns the size of the current terminal in rows and columns. Example:
$ stty size
24 80
You can read the rows and columns into variables like this (thanks to Janis' comment):
$ read myrows mycols < <(stty size)
Obtaining the size in pixels requires knowledge of your screen's resolution and I don't think stty
has direct access to such information.