Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Use [TODO: Code shorthand span ] To Get The Number Of Columns And Lines/Rows Count In A Terminal Window On A Mac

TL;DR - Columns

bash
tputs cols

-- results

55

TL;DR - Lines/Rows

bash
tputs lines

-- results

38

- I generally use [TODO: Code shorthand span ] when I need to figure out the number of columns or lines/rows a terminal window has

- This probably works on lots of linux machines too. ymmv are on windows

- I'm not sure if [TODO: Code shorthand span ] is installed by default or if it got installed by homebrew. I don't remember installing it, but if you don't have it you may have to do that work

- ` bash ` , ` zsh ` , and some other shells also set ENV vars that can be used to pull the numbers (link below)

Footnotes And References