title: How can I “manually” get my terminal to return its (character) size?
body: <p>Programs like <code>resize</code> ask the terminal about its size. And ultimately they will send some (ANSI) escape sequences to stdout and expect the terminal to react on those by itself returning some bytes.</p>
  
  <p>The effect of the mechanism is visible with this interactive Python snippet:</p>
  
  <pre><code>&gt;&gt;&gt; print('\x1b[21;t')
  </code></pre>
  
  <p>Gnome-terminal will insert visibly something related to the window title on stdin.</p>
  
  <p><strong>Which script snippet will provoke the terminal to write it’s size (in characters)?</strong> If the size is returned invisible, some simple transformation should be done to see something. Shell, Python, Perl, whatever language is fine. As this will be terminal specific, any common terminal emulator is fine (e.g. xterm, gnome-terminal, terminator, ...).</p>
  
  <p>Clarification: I don’t care about programs which tell me the size. I know about TIOCGWINSZ, which does not work over serial lines. I want to see code which uses escape sequences, which actually works over serial lines.</p>