[plug] Bash Ctrl+S
Juneidy Wibowo
plug at juneidy.wibowo.au
Thu Jul 16 18:27:02 AWST 2026
G'day all,
Sharing a revelation that I had today, that might sound obvious to long time linux users.
I am by no means a linux newbie, but nevertheless, I am always learning something new about GNU/Linux.
I am a primarily terminal user and I have always used terminal multiplexer like GNU-screen and tmux.
Occasionally, I would use the "copy mode" of the multiplexer to "freeze" the screen to copy a few stuff. And the string I want to copy can be a long JSON string that line wraps in my terminal.
Now if you use a mouse to highlight and copy this long string while in the multiplexer's "copy mode", the line wraps translates to a "new line" (\n) character.
So occasionally, I would use Ctrl+S to maintain the line wrap of this long string to copy, then continue with Ctrl+Q when I am done.
Here's the part that I never noticed and surprised me today: bash actually "freezes" the process while in this mode provided if the process writes to /dev/stdout.
I did a few tests with some simple for-loop in bash:
$ for i in {1..20}; do date >> /tmp/foo.log; sleep 1; done # Does not freeze the process with ctrl+s
Whereas
$ for i in {1..20}; do date >> /tmp/foo.log; date; sleep 1; done # Freezes the process with ctrl+s
I guess this only came as a surprise because I am so used to terminal multiplexer "copy mode" where the process continues to produce output while in this mode and you are fast-forwarded after you exited "copy mode".
I haven't really bothered to find out the history of this Ctrl+S but someone smarter than I am might shed some wisdom/history on this.
Regards,
Juneidy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.plug.org.au/pipermail/plug/attachments/20260716/ce695911/attachment.htm>
More information about the plug
mailing list