Solved: vi / vim editor is frozen by <ctrl + s>

As a longtime Windows user, I’m used to saving my documents with Ctrl+S. In Linux, however, I quickly learned that things are quite different.

While mucking around with vim for the first time (a clone of the popular vi text editor included in most Linux distros), I quickly bamboozled myself and somehow managed to completely freeze the console screen. The cursor sat blinking on the vim input, but nothing I typed would show up and no commands seemed to run.

It turns out I made a popular rookie mistake that happens to almost every Windows user staring at vi for the first time. I hit Ctrl+Swhile trying to save my document, which doesn’t “save” on Linux but instead executes an XOFF command – locking the console output, and making it appear that nothing I typed was showing up.

All I had to do to “unfreeze” the console and get back to work was run an XON command, which can be done by hitting Ctrl+Q. All the output you generated since hitting XOFF will now be displayed, and output will be shown as usual.

Takeaway? Don’t hit <Ctrl+S>, and if you do, <Ctrl+Q> will turn the console back on.

10 thoughts on “Solved: vi / vim editor is frozen by <ctrl + s>

  1. My vim was getting stuck sometimes and I didn’t know if it was a problem with tmux or vim, neither did I know how to recover from it. So this was really helpful, a thousand thanks!

  2. Very helpful and also provided a useful command in being able to lock/unlock the session. Thanks for writing this.

Leave a Reply to anD Cancel reply

Your email address will not be published. Required fields are marked *