¯\_(ツ)_/¯

thunder@home:~$

This is my home blog, mostly to share some useful info or code snippets
~ 1 min

Heya,

Sometimes while you’re working in your favourite IDE and do file save quite often with Control-S, and then switching to Terminal, you can accidentally push Control-S in there. And your terminal just “hangs”. Why and what should you do, instead of killing Bash process?

Why it’s happening?

This feature is called Software Flow Control (XON/XOFF flow control)

Software flow control is a method of flow control used in computer data links, especially RS-232 serial. It uses special codes, transmitted in-band, over the primary communications channel. These codes are generally called XOFF and XON (from “transmit off” and “transmit on”, respectively). Thus, “software flow control” is sometimes called “XON/XOFF flow control”. This is in contrast to flow control via dedicated out-of-band signals — “hardware flow control” — such as RS-232 RTS/CTS.

More info here: wiki/Software_flow_control

Wikipedia

What is happening under the hood is the “XOFF” is telling the TTY driver in the kernel to put the process that is sending data into a sleep state (like pausing a movie) until the TTY driver is sent an “XON” to tell the kernel to resume the process as if it were never stopped in the first place.

What should I do?

Contol-S enables terminal scroll lock. Which prevents your terminal from scrolling (By sending an “XOFF” signal to pause the output of the software).

Contol-Q disables the scroll lock. Resuming terminal scrolling (By sending an “XON” signal to resume the output of the software).

This feature is legacy (back when terminals were very slow and did not allow scrolling) and is enabled by default.

How to disable?

To disable this feature you need the following in either ~/.bash_profile or ~/.bashrc:

stty -ixon

Happy Contol-Sing!

Thank You For Reading