Ctrl+S freezes Vi Editor & Unix terminal? Here’s how you can resume it!
- Monday, April 24, 2017 By David Peter
Working on a Unix terminal and all of a sudden the terminal freezes after pressing Ctrl+S? Well, did you see the same behavior when you were editing a file using Vi? Not a problem, this tutorial will help you to resume it back. Generally, most of the editors would allow you to save a file using Ctrl+S and we do the same with Unix terminals and Vi editor and only to see those freeze. Unfortunately, hitting Ctrl+S in Unix terminal or Vi editor will freeze the screen. Why does it behave so?
Why Ctrl+S freezes Vi Editor and Unix Terminal?
To understand the reason behind, we need to go back to history. Yes, the days when Teletype models (an electro-mechanical teleprinter) were designed, much before the computers came into existence. These models were using a Software flow control – for instance, if the printer could not print data as fast as teletype were receiving data, then teletype would send XOFF (Stop transmitting for now) signal to the machine sending data and then to resume it back, it would send XON signal.
The keyboard equivalents of Ctrl+S for XOFF and Ctrl+Q for XON still survive in modern terminal emulators in Unix – the terminal emulators generally emulates the physical terminals (like VT100) which is something similar to working of teletypes. That’s the reason, Ctrl+S freezes the terminal and you just need to hit Ctrl+Q to resume it back to normal.
How to Unfreeze Vi Editor or Unix Terminal?
You can unfreeze or resume the terminal using Ctrl+Q.