Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I do a lot of ssh-ing, and periodically I hit Ctrl+S, which naturally sends an XOFF, and causes all kinds of problems (not to mention it takes a while for me to figure out what happened, then another while to remember that I need to press Ctrl+Q to recover.

I would much rather instruct Putty to never ever let me type XOFF.

Any ideas?

share|improve this question
4  
+1 for pointing out that recovery is possible with Ctrl+Q. Helped me a lot! –  Demento Apr 21 '11 at 17:49
    
+1 for actually asking how to disable this behavior because it's completely antiquated and useless for my purposes. Everybody on the web has the CTRL+q trick documented, but nobody has documented how to unbind the keys altogether. –  andrew Mar 11 '12 at 8:47
    
keep in mind that ctrl+q will restore the cached flow. That means, if you press ctrl+s and then go crazy pressing ctrl+c or anything else, when you press ctrl+q all that you pressed before will be played out. –  gcb Apr 17 '13 at 19:35

5 Answers 5

up vote 18 down vote accepted

Don't know about Putty, but you can use:

stty -ixon

on remote host, to disable START/STOP signals.

share|improve this answer
    
Thanks - any idea if or how this affects the console? Would it alter the behavior of shell programs? (The only thing I know about XON/XOFF is that it's used for serial flow control). Sounds like a good setting for .bash_profile. –  Seth Mar 29 '10 at 16:57
    
That should be stty -ixon. –  Oddthinking Feb 16 '11 at 1:44
    
Sorry. Updated my post to fix the typo. –  Bartosz Feb 22 '11 at 11:43
    
As I just commented to BlakBat on his answer, that makes ^S not send an XOFF, but it now puts me into i-search mode. Is there a way I can get bash (or PuTTY) just to discard any ^S? Even better would be if it could beep and/or flash at me ;o) –  Owen Blacker Feb 14 '12 at 15:06
1  
I've added stty -ixon to my profile scripts. I've read about 100 articles on how when you press CTRL+s by accident, all you have to do is CTRL+q to resume again...but I don't want my shell to intercept CTRL+s/q at all since I use them with vim quite a bit. Thank you so much for providing an answer nobody else seems to even consider. –  andrew Mar 11 '12 at 8:46

The PuTTY solution:

  1. before creating the session go navigate to Connection->SSH->TTY in the list.
  2. in the "Mode" dropdown box, select IXON (nb: as of version 0.60, this list is not alphabetically ordered)
  3. put "0" (zero) as the value of IXON.

Screenshot

Works as a charm, even if you open up a "GNU screen" on top of it, SSH to another host, or "su" to another user

If you're using GNU Bash, ctrl-S should allow you now to do a forward-search-history (aka: i-search)

You can see the difference in the output of "stty -a | grep -o ".ixon": With putty configured it prints "-ixon", without " ixon"

share|improve this answer
1  
Ok, that makes ^S not send an XOFF, but it now puts me into i-search mode. Is there a way I can get PuTTY (or bash) just to discard any ^S? Even better would be if it could beep and/or flash at me ;o) –  Owen Blacker Feb 14 '12 at 15:05
    
To deactivate an action, you can bind ^S to nothing via bind '"\C-s"'. This makes my PuTTY blink because the action is not mapped. –  BlakBat Apr 23 '12 at 10:04
1  
I tired on putty 0.62 and the above setting does not help. I tried to override XON, XOFF and with different values but nothing change. –  Dennis Cheung Nov 26 '12 at 1:42
    
same as @DennisCheung. btw this is the worst setting screen i've ever saw. what does those values even mean? auto? zero? anyway, removed the original IXOFF and added IXOFF=0, ctrl+s still does it's thing –  gcb Apr 17 '13 at 19:41

Open your .bash_profile and put:

stty -ixon

The value -xion doen't work for me. You can see the man entry: man stty.

share|improve this answer
    
+1 for stty -xion does not work on my centos, but stty -ixon works. –  Jichao Dec 9 '10 at 16:18
.bashrc example:
#
# Stop Putty from doing XOFF/XON with Ctrl-S/Ctrl-Q
# SOURCE: http://raamdev.com/recovering-from-ctrls-in-putty (Morgy, 7/14/08)
#
# stty ixany
# stty ixoff -ixon
### If needing to listen to Ctrl-S for some apps, use these two instead:
stty stop undef
stty start undef
share|improve this answer

I've got the opposite problem. Every once in a while, the host sends an XOFF to PuTTY but never sends the corresponding XON to PuTTY. In this case, nothing you do to PuTTY (short of restarting it) will unwedge it. In this case, all keyboard input to the host is blocked, but the host can still send data to PuTTY.

Disabling flow control in PuTTY doesn't work.

The way to fix this problem is to use

stty -ixoff

in your .profile. This prohibits the host from sending XON/XOFF. Note that the names of the options are totally confusing. ixon/-ixon means enable/disable flow control on the client side (meaning that the client can't issue flow control), ixoff/-ixoff means enable/disable flow control on the host side (meaning the host can't issue flow control).

Btw, the ASCII code for Ctrl-S and XON are the same ASCII character (code 19, 0x13). There's no difference. The settings change the interpretation of that ASCII character.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.