paperlined.org
apps > terminals
document updated 12 years ago, on Jun 6, 2012
There are a few ANSI codes that the server-side can send, to request some information from the client side.

Run ansi_replies.sh to see how a particular terminal responds.

query cursor position

query: <ESC>[6n
response: <ESC>[{row};{column}R

answerback / ENQ (enquire) character / W-R-U (who are you)

query: ^E
response: {stationid}

The response is usually user-configurable. For example, xterm's default response is blank, but this can be set via an .Xresources of answerbackString.

query device status

query: <ESC>[5n
responses:

query printer status

query: <ESC>[?15n
responses:

query device attributes

query: <ESC>[c or <ESC>Z
responses: