Konsole/Terminal - Ctrl-S / Ctrl-Q Flow Control

Investigating how to search your command history I came upon Ctrl-S for searching forwards. I assume it’s useful if you noticed a command you’ve used, but forgot to take a note of it and you want to find that again instead of starting over. It’s easy to press Ctrl-R repeatedly and going too quickly, I guess it could happen.

Now, Ctrl-S is used for pause input from the keyboard and let other input peripherals “talk”. In 2024, is this really needed?

Historically, I read, it was used for RS-232 hardware and similar. Is that really a thing? Can you give some examples?
Flow control: https://en.wikipedia.org/wiki/Software_flow_control

It feels like it should be an option in Konsole/Terminal for those who want to use that flow control feature. Sure, I can understand that some hardware driver developer might want to use this feature of flow control, but hogging an otherwise useful keybinding is strange. Konsole/Terminal has focus, you think you are in Geany or Kate, then get into Konsole/Terminal again and it doesn’t respond to input. Takes a few moments before you realize what happened.

What are the options for changing things around?

I assume you could turn that flow control option off altogether. A person on Stackoverflow suggested one could use: stty -ixon

Anything else?


I have run into the issue a couple of times - I didn’t connect it to communication flow control though - just speculated - what!? is going on :grin:

The best place to talk about it will be the KDE hq Brainstorm - KDE Discuss

I have looked over shortcuts and keybindings - I have not found these bindings anywhere.

There are a thousand reasons why someone may want to ‘suspend’ or ‘stop’.
But I also understand some of the consternation (?) around the seeming duplicate/overlapping combinations.
By default, for example, with bash we have

$ bind -p | grep C-s
"\C-s": forward-search-history

As well as from the terminal emulator

$ stty --all | grep S
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S

The terminal takes precedence over the shell, so with the example configs above my Ctrl+s results in a stop.
Which actually produces a rather nifty warning with an explanatory link and instructions on how to unstop. (which it refers to as ‘suspend’ … which is actually ctrl+z and for a running process, but I digress…)

Personally, I like it, and Ctrl+r is enough for searching for me.

This article seems to go over all the things … including some ways to approach should you want to, for example, disable that flow control;

Or just change the keys for XON/XOFF

1 Like

Thanks. I’ll mark the longer reply as solution because of the thorough discussion around the “problem”, thanks to both of you.

I don’t see why. Flow control is built into every decent terminal. Even the tty has it.

After the fact notes: Questions are rhetorical and don’t need an answer.
If the tty has this feature, as was pointed out, then, why does Bash use a conflicting keybinding? Shouldn’t they “know” that is was already used at the time the keybinding was “invented” over at the “Bash office”? Assuming here, of course, that the Ctrl-r feature is a part of Bash and that tty was “invented” before Bash was.
Now, since Bash is the shell being used on my machine one might ponder the question: didn’t the Bash people consider all things when they wrote the shell, like keybindings, or does this Ctrl-r thing come from somebody else? It feels like the tty is old, really old, since it apparently was in place already when they didn’t have monitors, but previewed things on deceased tree material.
I mean, why would you use that keybinding if it on the Terminal the people who wrote Bash used would pause input? Wouldn’t they have noticed it, like so many others do today? Was it failure of testing? And why Ctrl-s? (Is that Stop? Then, why Q? Qontinue? Close proximity to S?) Is Ctrl-r (forward) occupied? I can’t see that Ctrl-f does anything in Konsole/Terminal (perhaps it does in tty?) and in my mind Ctrl-f would have been the more logical letter to use and the “problem” would have been solved.
Anyway, enough rambling of various ideas that pop up as I think about these things. Thanks for reading, if you did. :slight_smile: -Edit: Changed the uppercase letters to lowercase, since Ctrl-F seems to be a thing with tty:

From man stty:

-F, --file=DEVICE
              open and use the specified DEVICE instead of stdin

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.