What is the point of Ctrl-S?

Ctrl+S stops all output to the terminal which can be restarted with Ctrl+Q.

But, why does Ctrl+S exist in the first place? What problem was trying to be solved by putting that control sequence in place?

Asked By: Jeff King


It’s a control character from the time of the VT100 terminals and similar. There was limited scrolling capability (if any) on those terminals to begin with the CTRL-S allowed you to freeze output to view what is currently on the screen without it being written off.

Most everything that you see in modern terminals was put in place to emulate those older terminal systems.

Answered By: Livinglifeback

Long before there were computers, there were teleprinters (a.k.a. teletypewriters, a.k.a. teletypes). Think of them as roughly the same technology as a telegraph, but with some type of keyboard and some type of printer attached to them.

Because teletypes already existed when computers were first being built, and because computers at the time were room-sized, teletypes became a convenient user interface to the first computers – type in a command, hit the send button, wait for a while, and the output of the command is printed to a sheet of paper in front of you.

Software flow control originated around this era – if the printer couldn’t print as fast as the teletype was receiving data, for instance, the teletype could send an XOFF flow control command (Ctrl+S) to the remote side saying “Stop transmitting for now”, and then could send the XON flow control command (Ctrl+Q) to the remote side saying “I’ve caught up, please continue”.

And this usage survives in Unix because modern terminal emulators are emulating physical terminals (like the vt100) which themselves were (in some ways) emulating teletypes.

Answered By: godlygeek

BTW, if you are listing a long output on your screen, chances are that you do not necessarily read as fast as the computer that spits out the output. Using CTRL-S/CTRL-Q on a cat (or active tail) is VERY useful to stop and resume output.

Answered By: mdpc

On ancient teletypes with a paper tape reader, receipt of a control-Q would turn on the paper tape reader and start sending out characters from the tape as though they had been typed at the keyboard. Control-S would turn off the paper tape reader. If one considers that teletypes were originally intended not to print data from computers, but rather from other teletypes, it should be pretty clear how “turn off paper tape reader” could be construed as analogous to “request other end to stop transmitting”.

Incidentally, control-R would turn on the paper-tape punch, such that every character received by the teletype (or, if local echo was enabled, typed at the keyboard) would also get punched to the paper tape; control-T would turn off the paper-tape punch. Unlike the operations associated with control-S and control-Q, however, those operations seem to have no modern equivalent.

Also, the original names for control-Q/R/S/T were DC1/DC2/DC3/DC4 (“Device Control 1”, etc.) While I’m not certain of the history, such naming would suggest that originally they were intended to trigger some unspecified kind of action, but the most common thing people did with DC1 and DC3 was to control the paper tape reader.

Answered By: supercat
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.