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.

Get The Number Of Columns And Rows In A Terminal Window With ENV Vars

ENV Vars

Both [TODO: Code shorthand span ] and [TODO: Code shorthand span ] set environmental vars for the number of columns and lines/rows in a terminal window. For example :

bash
echo $COLUMNS

-- results

56
bash
echo $ROWS

-- results

38

- Not all shells set these ENV vars. Determining that is left as an exercise for the reader

- There's also al [TODO: Code shorthand span ] command is that can provide the info (link below)

Footnotes And References

  • Use tputs To Get The Number Of Columns And Lines/Rows Count In A Terminal Window On A Mac