MacOS – Why does this cause Mac OSX to print over SSH

bashcommand linemacosscriptssh

While screwing around and breaking things I came across these stupid commands (if executed in order it causes what I got):

cd / && cat vmlinuz

cd /boot/ && cat init*

It causes special characters that aren't recognized by the system like ��� however, for some reason it causes weird effects like causing iTerm2 to send a bell (a notification to the system) like the screen shot:

enter image description here

However, the weirdest this is that is causes Mac OSX to print (screenshot):

enter image description here

Can someone explain to my why this happens, especially over SSH?

Thanks in advance!

Best Answer

Terminal.app probably implements the "media copy" (printer) escape sequence from VT100s. You can read about those control sequences at vt100.net, or in the XTerm Control Sequences, e.g.,

CSI Pm i  Media Copy (MC).
        Ps = 0  -> Print screen (default).
        Ps = 4  -> Turn off printer controller mode.
        Ps = 5  -> Turn on printer controller mode.
CSI ? Pm i
      Media Copy (MC, DEC-specific).
        Ps = 1  -> Print line containing cursor.
        Ps = 4  -> Turn off autoprint mode.
        Ps = 5  -> Turn on autoprint mode.
        Ps = 1  0  -> Print composed display, ignores DECPEX.
        Ps = 1  1  -> Print all pages.