Since the key combination Control+s is widely used as a shortcut to save files in GUI applications such as text editors, image editors, web browsers, etc. sometimes you are betrayed by your subconscious when you are working from the Linux command line and you use that same key combination when you are for example editing a Vim document when trying to save it. Then you notice that no key answers, the shell is locked and you can no longer do anything else in it. Even worse, you get a cold sweat because you can’t continue editing your document and you can’t save the changes.
Don’t panic, don’t panic. The key combination Ctrl+s that you pressed only pauses the flow control (XOFF), that is, your terminal will continue accepting inputs from keyboard, but it will not display any output, giving the impression that it is blocked, frozen, that it hung up. The only thing you have to do to resume flow control (XON) is to press the Ctrl+q combination on your keyboard and everything will be back to normal.
These escape sequences have their origin in the old RS-232 terminals that were used to connect to large mainframe computers. Since what we use now to execute commands in Linux are emulators of those terminals, this behavior is not really something that only affects Bash, but also other shells such as sh, Zsh or Csh.
Leave a Reply