Raam Dev » thoughts essays journal notes contact about subscribe rss

Recovering from CTRL+S in Putty

Every once in awhile, I’ll press CTRL+S by accident while I’m inside a terminal window. For the longest time, this simple accidental keystroke meant I had reconnect to my Linux server, kill whatever program I was running, and then start it again. Eventually I got sick of this happening and decided to do what I should have done in the first place: Google It.

Apparently CTRL+S actually does XOFF, which means the terminal will accept key strokes but won’t show the output of anything. It will appear as if your terminal is dead when it’s really just waiting to be turned back on. The fix? Simply press CTRL+Q to turn flow-control on (XON). If you pressed a whole bunch of keys before pressing CTRL+Q, you’ll see the output from those keystrokes.

In the Windows world, CTRL+S is used as the Save command. Over the years, I’ve developed the habit of pressing CTRL+S every few minutes while working on a document, simply because I’ve had too much work lost from stupid errors. Thankfully, this habit will no longer get in my way of working in the Linux world.


  1. Yes!!!! Thanks so much! I imagined this was a simple issue, but my previous attempts at screaming and banging on the keyboard failed to elicit the magic Ctrl-Q combination…

  2. Haha, I’m glad this helped you! It drove me crazy for many months too. I just couldn’t believe it was so easy to crash a terminal session and I didn’t want to unlearn my habitual “Ctrl+S” habit for fear of losing work later on down the road.

  3. wicked, cheers! This has been bugging me for a while.

  4. phew!!!
    thanks so much…. i was fed up with this since morning…. can’t help pressing ctrl-s to save a file i’m editing

  5. Thanks! Been having problems with this.

    Now knowing what it does, that could be quite useful. Would be great if I want to join a massive amount of lines in VI (uppercase J) over a slow connection. It’d still draw it all upon ctrl+q, but then I know I can tab away while it labors over the joins.

  6. That’s a great use of ctrl+q, Jerek! Thanks!

  7. Sri Kiran Jyothi

    This was one hell of a bugging issue. Thanks a lot for getting rid of a really big pain in the neck.

  8. Its good to recover from ctrl-s BUT i need ctrl-s a lots in emacs, putty freezes everytime i press ctrl-s, how can i disable it?

    Strange, sometimes i have this problem, sometimes i dont. I dont get it.

    If you can help me, thanks

  9. Ok, i figured it now.

    http://blog.i64.pl/PiosBlog/200610/29-linux-keyboard-shortcuts-you-should-know-about/

    for somereason, my emacs lost his configuration when ran under screen. i created new screen window, started emacs and ctrl-s worked as search command as it should.

    Thanks.

  10. Hey Tree, thanks for the update and the URL!

  11. Lucas

    Thanks a lot for this!!!

  12. Thanks For this, I found a way of disabling the CTRL-S sending XOFF.

    add this to your .bashrc (man stty for more options)
    stty ixany
    stty ixoff -ixon

    Some programs like rtorrent listen for CTRL-S. This might still be getting mapped to XOFF, we have only disabled listening to keybopard XOFFs NOT sending them. If you need to send CTRL-S and/or CTRL-Q you can add
    stty stop undef
    stty start undef

  13. Hey Morgy, thanks a lot for the tip! That is really useful.

  14. Blaze P.

    thanks so much saved my life!!!

  15. Thank you soooooo much! This has been really driving me crazy. Thanks!!!

  16. Thank you so much! Thank you , thank you!!

  17. Thank you! This has been driving me nuts all day while I’ve been working in VI! My CTRL-S habit kept “freezing” Putty and requiring me to reconnect to the server, argh!!

  18. Man, you’re my saviour !

  19. Hey, thanks for a nice tip..
    bless google + helpful people on the internet

  20. Just had to say thanks, I should have googled this a long time ago! d’oh! I use vi for text editing but I often hit ctrl-s out of habit from the many Windows programs using that shortcut to save.

    This also sounds like a great way to hide some commands if someone is looking over your shoulder! hehe

  21. Haha yeah, it would definitely be a good way to hide commands from someone looking over your shoulder, but you’d need to have very good typing accuracy! :D

  22. Just to echo other people thanks!
    I have bitten by this quite a few times, pressing Ctrl-S by accident when I wanted to press Ctrl-A in emacs.

  23. WOOT!!! i completely agree with your “i should have googled it” … so nice!!

  24. You have NO idea how helpful you’ve been today. Likewise, I have the habit of pressing to save and it usually becomes an issue when editing a document in vim. No longer!

  25. Always happy to hear I could help! :)

  26. Too easy….

    Na endlich eine Lösung zu diesem blöden ShortCut, da hat das ewige öffnen von neuen Sessions endliche ein Ende

    Danke, danke, danke

  27. Bitte, Bert! Glad to help!

  28. Matthias

    Thanks a lot from me also! (#29 in this list, eh?)

  29. You’re welcome, Matthias! :D

  30. Kenneth

    Thanks! That saved me quite a headache as well.

  31. Good work, this has been an annoyance for some time :)

  32. This has happened to me a couple of times while editing files in vi – I thought I’d gone into a weird vi mode that I couldn’t get out of (yet couldn’t find documentation on it anywhere!). Then today it happened on the command line so guessed it was putty. Thanks for the post! Will save me time and time again in the future!

  33. thaaaaaaaaank you :)

  34. Johnson

    Im currently using the Windows version of Putty and for the life of me can’t figure out how to disable Ctrl-S from suspending my Putty window, its getting quite annoying.

    I think the Windows version differs from the version the above users are using since I don’t have a .rcbash to work with.

    I have tried going to Connection > Serial and selecting None in Flow Control but no luck.

    Please help

    • Hi Johnson,

      I’m not sure if you can entirely disable CTRL+S in Windows, but simply pressing CTRL+Q after accidentally pressing CTRL+S should return the terminal to a normal state.

  35. thanks

  36. theMike

    You are awesome! I press CTRL+S wayyyy to much out of habit.

    • CTRL+S is a good habit to have! I’d rather accidentally suspend my terminal than lose a ton of work in some other Windows program! :)

  37. galred

    Oh boy! I had been totally over this since yesterday and bugged a couple of people at work also. I am so glad to have found this blog. Thanks Raam for pointing this out. Whew…. I am relieved now :)

  38. Thank you so so much!

  39. Awesome post

  40. It’s hilarious how such a simple thing can wreak so much havoc. This was driving me nuts for a while. And judging by the amount of comments, some other people too… Thanks for the tip.

  41. Hi Raam,

    Many Thanks Dude…
    I have faced this pain many times man… Instead of pressing ctrl+c i will press ctrl+s…. denn fucked,….. close that session open a new one…
    from now i wont have such probs… :) thanks again….

  42. Thank you thank you thank you.

  43. Thanks so much!

    In Emacs, CTRL+X then CTRL+S saves your document. Unfortunately, I’ll oftentimes press CTRL+Z (fatfingered CTRL+X) then CTRL+S. The CTRL+Z will background Emacs (returning to the shell) and then the CTRL+S performs the XOFF, which sucks because it meant recovering the file that I was attempting to save.

    Thanks so much for this solution!

  44. haha this made my day and put big smile on my face!!!!! i was about to close the terminal n reconnect but yeah Googled it and saved me from alot of anger!

  45. You just saved me from a session of head-banging. Thanks!

  46. Very good responses from many users. Great post.
    I have a quick question.
    Does CTRL+s pauses the processing until we press CTRL+q?

    • Howdy. No, it does not pause processing … it just locks the scroll buffer. For a simple illustration of this, start up screen, then run the following:

      while sleep 1 ; do date ; done

      While this is running, hit CTRL-s, wait ten or so seconds, and hit CTRL-q.

  47. Chandra Neelakantan

    Many thanks!
    A chilled beer is there for your disposal should you travel to Munich or Bangalore!

    • You’re welcome, Chandra! I’m planning on traveling soon, so I might take you up on that offer! :D

  48. PolarBear

    Thank You !!! Finally no more reloading sessions. :)

  49. Shyam Bhawsar

    Hey Buddy,
    Thanks a lot for this useful information…

  50. you are a life saver. ctrl+s was a constant pain for me. thanks for putting up this page.
    -admirer

  51. Thankful

    You life saver you! Thanks :D.

    A thankful man!

  52. Martin

    Thanks

  53. Bruce

    Thanks. Was getting extremely tired of exiting putty and recovering swap files. :)

    • You’re welcome, Bruce! I remember the time consuming frustration of recovering those swaps files! :)

  54. You da man… Was driving me crazy!!!

  55. bitkidoku

    thank you for the information, i realized it was ctrl+s that freezed the screen not connection problems after the third time

  56. French guy

    Merci beaucoup!
    Tu m’as sauvé la vie…

  57. Kokopelli

    Son….Son…..SON….
    I’m saying…..
    Thank you.

  58. thanks……

  59. :D … can’t say more.

  60. Thanks, i was having the same problem :) thanks a lot.

    \m/

  61. Omg thanks for this! I got soooo sick of this crap. I landed here by searching this on Google believe it or not:

    “what the fuck does control s do in vim”

  62. Awesome! I’ve been breaking my head on this one… Saves me a lot of time reconnecting and rewriting some code I’ve written between the previous save and when pressing CTRL + s!

  63. Thanks!!! I needed that. :-)

  64. @thefrenberg

    “Every once in awhile, I’ll press CTRL+S by accident while I’m inside a terminal window. For the longest time, this simple accidental keystroke meant I had reconnect to my Linux server, kill whatever program I was running, and then start it again. Eventually I got sick of this happening and decided to do what I should have done in the first place: Google It.” – word!

  65. This had me pulling my hair out. Thanks!

  66. Christoffer

    Thanks!
    This have been bugging me a looong time

  67. Thanks a lot!

  68. Thank you soooooooooooo much.. I would have been in trouble.. thank you thank you thank you…

  69. Arnold

    Thank you! This happens to me every now and then and never fails to p!$$ me off.

  70. Thank you so much.. this has been bugging me for a while now.. cheers :)

  71. cheers

  72. haha, this was great thanks.

  73. sugan

    thnx a lot :) that worked well..
    useful for de one who s used to Windows Doc

  74. I love you.

  75. HerrSerker

    Thanks to google I found you
    And thanks to you that you found the solution

  76. Alex

    Man, thanks so much! I was going insane for a while with that one.

    I’m a Windows programmer who occasionally uses Linux, and I honestly can’t stop myself from hitting ctrl+s every few minutes.

  77. Clayton

    “Every once in awhile, I’ll press CTRL+S by accident while I’m inside a terminal window. For the longest time, this simple accidental keystroke meant I had reconnect to my Linux server, kill whatever program I was running, and then start it again. Eventually I got sick of this happening and decided to do what I should have done in the first place: Google It.

    Over the years, I’ve developed the habit of pressing CTRL+S every few minutes while working on a document, simply because I’ve had too much work lost from stupid errors. Thankfully, this habit will no longer get in my way of working in the Linux world.”

    DEJA-VU. This is exactly why I’m here.

    Thanks for posting this (and being on top of the google hits!)

    • Haha, thank Google for getting me to the top… it seems I’m certainly not the only one. :)

  78. Robbie

    Thanks for this.

    After some messing around I noticed CTRL+C works as well, at least for me. The only difference is that it does not execute any of the commands entered since CTRL+S was pressed. It seems to be just a simple interrupt.

    Cheers.

    • Thanks for the note, Robbie. CTRL+C never worked for me, so perhaps its a difference in terminal settings or keybindings.

  79. Dave Brown

    Funny that after decades of using Mac/Windows/*nix, I only just started making this mistake. Ctrl-Q is so much easier than killing the PuTTY session, logging in again, and recovering the file! Add my thanks to the many over the past four years.

    • You’re welcome, Dave! It took me almost a year of pressing CTRL+S and then killing Putty before I hunkered down and looked for the solution. :)

  80. DaveG

    This helped me too! The gift that keeps on giving.

    • It’s definitely the gift that keeps on giving! I had no idea how many people this would help when I published it. :)

  81. Damn love you man!… i was sick and tired of that shit…

  82. Espen

    Thank you very much. Pressing Ctrl+S to “save” while in a terminal session has been quite a huge problem for me down the road. This post made my day. =)

  83. Visko

    Thank you! I’ve also been trapped – until now :).

  84. Zhipeng

    Bravo. I finally got rid of this trouble by your Ctrl+Q way. Thanks much. 

  85. Jeremy

    Yet another soul saved from lost work by your post.

    This is why blogs are awesome. Post about some obscure thing you figure out, you never know how many people you’re going to help.

    Thanks!

  86. Leo Medeiros

    Man, you saved me! Thanks from Rio, Brazil!

  87. Yay!

    I’ve been doing this for 12 years or so.. THANK YOU :D

  88. Your are great.
    I work a lot with putty and had that problem since…. years!. I thought it was a bug in putty or on my ssh server.
    This really helps my <>. Thank you so much.

    • Thanks, Py! I thought it was a bug in Putty or SSH too, but then I realized both of those have been used by so many people that I must be missing something!

  89. This post will never be old, because there are many people still trapped on Ctrl+S habbit like me , haha.

    Thanks Raam.

  90. Single most useful post I’ve read all year! Thanks!

  91. 4 years on from your post and it’s still a godsend.
    And while I’m here, just seen your intriguing About description. I think I’ll read more. I’m liking the social responsibility bit. We’re just about to launch a boardgame for iPad with 5% going to Amazon Conservation Association. Seems like a little way to give something back in the right direction.

    • Paul, that’s fantastic! Thank you for setting an example for others to follow. Imagine how much good we could do if all apps in the App Store gave 5% of each transaction to a charity. And I mean really, when you look at it on a per-transaction basis, would we miss that tiny amount?

  92. Claudio

    You just became my personal hero.
    Thanks!
    ztank

  93. That Guy

    I share everyone’s gratitude towards you. You saved me a lot of trouble.

  94. Thank you so much! I’m always alt-tabbing back and forth between Komodo Edit (uses CTRL-S to save) and a putty terminal and I’ve run into this a million times.

    So sick of having to restart putty session and recover whatever file I was editing.

    This is an awesome tip.

  95. Thanks a boatload! You just saved my notebook from serious physical damage.

  96. Wow, thanks! After having my putty console freeze for the 3rd time today, I decided to google “putty ctrl+s” and lo and behold, your page came up and solved all my life’s problems!

    Seriously though, thanks for posting :)

  97. This thing is really anoying… Thanks a lot, it was driving me crazy

  98. Awesome. I though it was vim getting back at people who use gui editors! Forgot all about putty in the middle. Thx much.

  99. Thanks, this helped so much!!

  100. A life saver! Greetings from Chile!

  101. This was such a helpful post!

  102. Steven Wright

    Oh man thanks, this was driving me nuts.

  103. Thanks a lot!
    The Ctrl+Q really kills the devil :)

  104. wow – this is an active thread, and long-lived! and well deserved – I am new to vi and you saved me from torment. Thanks a ton!

  105. Haha…i see every few weeks someone stumbles across your helpful tip…
    Saved me from some frustration…the power of google plus helpful people …. Thanks
    Ahmed from South Africa

  106. Thank you very much !

    I can see I’m not alone :D

    Have a good day.

  107. Fantastic; this has been driving me nuts for two years; finally googled it… ding! Solution! Thanks! Cheers, Chris

  108. tooHectiX

    YEAH!!! You’re THE MAN!!! thanks BRO!! cheers! :)

  109. I knew there had to be a way out of CTRL+S hell. Thanks for putting this on the web. You’ve been a big help!

  110. Infinite props man, this was starting to piss me off hahaha.

  111. And your post just keeps on giving …

    Another satisfied customer – months of frustration has finally ended.

    Thank you!

Leave a Reply

Subscribe without commenting.


Readers who shared Recovering from CTRL+S in Putty

  1. Death of the Terminal Session | Adam Poirier shared this post on July 21, 2008 at 23:50
  2. cl4es shared this post on March 11, 2010 at 15:51
  3. Joy shared this post on March 14, 2010 at 11:58
  4. Michael Carriere shared this post on August 13, 2010 at 13:24
  5. Rajesh Kumar shared this post on August 28, 2010 at 02:29
  6. Indigo shared this post on September 12, 2010 at 18:44
  7. みはbot shared this post on September 12, 2010 at 18:51
  8. André Norbim shared this post on January 2, 2011 at 16:31
  9. junichi_y shared this post on January 31, 2011 at 11:20
  10. AJ Simpkin shared this post on March 18, 2011 at 17:49
  11. Putty help - Multiplay Forums shared this post on March 24, 2011 at 15:15
  12. David Hergert shared this post on April 2, 2011 at 08:31
  13. Logan R. shared this post on May 2, 2011 at 15:24
  14. Jonas Giehl shared this post on November 17, 2011 at 19:34
  15. Marc Climent shared this post on December 22, 2011 at 10:00
  16. codestem shared this post on January 5, 2012 at 20:50
  17. fin-sn.de shared this post on January 17, 2012 at 08:54
  18. Ronald Lukassen shared this post on January 18, 2012 at 05:14
  19. KRRS shared this post on February 6, 2012 at 10:38
  20. Eric Leschinski shared this post on February 23, 2012 at 11:18
  21. Chris Schuld shared this post on February 27, 2012 at 04:30
  22. Albert Baldassarre shared this post on March 26, 2012 at 15:53
  23. Murat shared this post on April 15, 2012 at 19:26
  24. Murat shared this post on April 15, 2012 at 19:27
  25. Juan Ara Monzón shared this post on April 23, 2012 at 07:38
  26. Noah Spahn shared this post on May 2, 2012 at 22:26

Other posts you may enjoy:

Where in the world is Raam?

Join the Facebook Community

Raam Dev » thoughts essays journal notes contact about subscribe rss

Powered by WordPress and other Open Source Software
Uncopyright by Raam Dev