Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to know my current xterms' window sizes. I'm using Cygwin. Is there a command to just print that to the prompt?

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

If it's an actual xterm, the following should work (tested on a PuTTY session, since I don't have Cygwin installed at the moment):

stty -a | sed 's/;/\n/g' | grep rows | awk '{print $2}'

In my case, that returned 24. Similarly,

stty -a | sed 's/;/\n/g' | grep columns | awk '{print $2}'

returned 80.

All the commands involved should be standard in Cygwin or any UNIX-like system. I'd be very surprised if they didn't work equally well in a Cygwin console prompt.

share|improve this answer
    
This works in Cygwin's xterm :) –  Matthew Read Jul 6 '11 at 1:06
    
thank you this works great! –  Robb Jul 6 '11 at 13:45
add comment

Gives you the size in characters:

 echo $COLUMNS " " $LINES

Whether it works in cygwin? You tell us!

share|improve this answer
    
This doesn't work in Cygwin's xterm :( –  Matthew Read Jul 6 '11 at 1:05
add comment

Install the ncurses package, then execute

tput cols; tput lines
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.