Tput
From wikinotes
The Termcap DB is a library/db that abstracts control codes to manipulate a terminal.
The tput
command can interact with it from shellscript.
Documentation
man tput
https://man.archlinux.org/man/core/ncurses/tput.1.en
Size
tput lines # height of terminal in chars tput cols # width of terminal in chars