Bash shell becomes inactive on Ctrl+S

Posted in Linux/Unix/BSD -

If you've ever accidentally hit Ctrl+S in the Bash shell it appears to come inactive and no matter what you do no output is echoed and nothing appears to be happening. This post looks at how to make the shell active again.

The Ctrl+S shortcut key sequence activates XOFF which is used to pause the sending of data etc (read more here at Wikipedia about software flow control). In the Bash shell this buffers all your commands and won't run them until you send XON which is done with Ctrl+Q.

I only learnt about this a few days ago when I accidentally pressed Ctrl+S while doing something on one of my webservers - I was meaning to press Ctrl+D to logout which is the only reason I knew which keystroke I had hit instead. It had baffled me years ago why my Bash shell suddenly became unresponsive when I'd hit what appeared to be some random keystroke combination. When it happened to me a few days ago I decided to work out why it does this and what the solution is. I remember in the past having to kill my CLI session because I didn't know what else to do.

So in summary, it's Ctrl+S which suspends the output and you need to hit Ctrl+Q to resume output again.



Related posts:


Comments