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.

Update: A commenter suggestedΒ a way to disable CTRL+S from sending XOFF altogether:

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

Update: A commenter provided a tip for making CTRL+S actually save the file in Putty'd VIM.

Write a Comment



  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. 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

  4. 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.

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

  6. 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

  7. 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

  8. 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!!

  9. 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

  10. 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! πŸ˜€

  11. 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!

  12. 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

  13. 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!

  14. 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.

    • 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! πŸ™‚

  15. 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 πŸ™‚

  16. 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.

  17. 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….

  18. 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!

  19. 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!

  20. 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.

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

  22. 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”

  23. “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!

  24. 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.

  25. “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!)

  26. 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.


  27. 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. πŸ™‚

  28. 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. =)

  29. Bravo. Iγ€€ο½†ο½‰ο½Žο½ο½Œο½Œο½™γ€€ο½‡ο½ο½”γ€€ο½’ο½‰ο½„γ€€ο½ο½†γ€€ο½”ο½ˆο½‰ο½“γ€€ο½”ο½’ο½ο½•ο½‚ο½Œο½…γ€€ο½‚ο½™γ€€ο½™ο½ο½•ο½’γ€€οΌ£ο½”ο½’ο½ŒοΌ‹οΌ±γ€€ο½—ο½ο½™οΌŽγ€€οΌ΄ο½ˆο½ο½Žο½‹ο½“γ€€ο½ο½•ο½ƒο½ˆοΌŽγ€€

  30. 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.


  31. 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!

  32. 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?

  33. 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.

  34. 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 πŸ™‚

  35. 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!

  36. 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

  37. And your post just keeps on giving …

    Another satisfied customer – months of frustration has finally ended.

    Thank you!

  38. After finding that XOFF was what was happening on a Ctrl+s from your blog here, this is is what I use to make Ctrl+s actually save the file in putty’d vim:

    .bashrc :

    # turn off Ctrl + s XOFF (XON is Ctrl + q)
    stty ixany
    stty ixoff -ixon
    stty stop undef
    stty start undef

    .vimrc :

    ” Ctrl+s to save
    map <C-s> :w<cr>
    imap <C-s> <ESC>:w<cr>a

    ” Ctrl+q to quit, hold shift to discard changes
    map <C-q> :q<cr>
    imap <C-q> <ESC>:q<cr>
    map <C-S-q> :q!<cr>
    imap <C-S-q> <ESC>:q!<cr>

  39. GOD! This has been driving me nuts. For the longest time, I could never figure out what “killed” the terminal session. Without even thinking about it, I’ve gotten in the habit of hitting CTRL-S about every two minutes or so – or at the break of a thought or idea. This has become so habitual, I don’t even know I do it – chalk it up to a necessary, learned survival instinct thanks to buggy Microsoft code.

    I didn’t realize until just the other day (and we’re talking YEARS of this happening to me) that what was happening was actually a result of something _I_ was doing!

    I just did it again tonight and decided to again Google the “fix” because I knew it could be recovered from – just I couldn’t remember how. I know I won’t remember either, so A HUGE THANK YOU for the .bashrc config! (and for this article in general). No longer do I have to kill the terminal and re-establish the connection and login all over again!!

    _Much_ appreciated………………..

    • Haha, I hear your frustration. That’s exactly what got me to write this in the first place. πŸ™‚ I’m glad I could help and provide a place for others to share their tips!

  40. Wow… after a number of years of having this problem I finally decided to Google it – many thanks for providing a fix to this age-old nuisance!

  41. This has been bugging me for quite some time. I showed some courage to google about it and found this. Thanks for putting this together.

  42. I’m very grateful for this post. Like you, I’d restart my terminal session and it became a nuisance, well not any more. Thanks again.

    • Glad I could help, Angsar! I had no idea how helpful this one post would be when I published it a few years ago, but I’m glad I did! πŸ™‚

  43. Hey Ram…. its been 5 years now I was battling with this irritating issue. I was so dumb that I never searched for this over net in these many years. Even you post is 5-6 years old but you will still find your FANS for this particular post. Thank you so much for this. :). Add myself in your fans list πŸ˜‰

  44. Haha I’ve been doing the same until I came across this article today πŸ˜€

    Funny how so many people have had the same problem and it makes me wonder how many more people are putting up with this and how many people have trained themselves to NEVER do CTRL + S in PuTTY πŸ˜€

    Thanks for solving this for me!, Ste

    • Haha, yeah, it’s an interesting study in human procrastination! I avoided researching the problem for years, instead choosing to force myself to unlearn CTRL+S in PuTTY. That didn’t work, so this post was born, and now it’s serving people who arrived at the same conclusion I did: Why not just research how to solve the problem? πŸ™‚

  45. That is awsome! Thanks for the tip – ive only just started pressing ctrl+s and its been bugging the heck out of me. Nice to know there is a way to continue working πŸ™‚

  46. Much thanks for the help. Spent several days thinking I had to restart my session again and finally got curious enough to see if anyone else had this issue. 6 years down the road and your post is still helping out. Thanks! πŸ™‚

  47. Thanks this was helpful. For years I was miffed that an accidental tap of the Windows Menu Key (that windows logo key on many keyboards) seemed to “freeze” my PuTTY sessions. After finding this link, I realized that I can “unfreeze” the PuTTY session by typing Ctrl+Q (I am not sure if I want to prevent the Ctrl-S behavior as you also document via stty settings but that too is a useful tip given my tendency to fat finger the windows key).

  48. Thank you so much! I was gettingΒ annoyedΒ by constantly having to open new sessions over this. At first I thought it was some random connection/bug/something, but I started noticing a pattern with the CTRL-S so a quick Google search sent me over here, and you saved the day, and possibly a lot more days to come πŸ˜‰

    • Woohoo! I’m glad I was able to help, Fredrik! πŸ™‚ That makes me wonder how many hours/days/years of time this one post has collectively helped save humanity…

  49. Another use case for this is with the very handy screen tool, that uses Ctrl-A to switch between screens.

    As it happens, I pressed the neighbor ‘S’ instead of ‘A’ and was wondering what sort of black magic had frozen my session… Β  Β  Β …until I found this. Thanks!

  50. Thanks so much for this. Had been happening to me forever and I was loosing a ton of work because I would just exit out of my terminal. Thanks!

  51. You have helped me with a “problem” with VIM πŸ˜›
    Accidently I pressed on CTRL+S to save and then I was stuck.. after reading this, I have recover my terminal window πŸ˜€

    Thanks… πŸ™‚

  52. Thank you Thank you Thank you!

    I’ve dealt with the same exact issue for the same exact reason as you! I finally googled it and brought me to your page. Thanks again!

  53. It helped me a lot. I was wondering why my session hanged. I also have the same habit coming from the windows world. Thanks Raam!

  54. thank you so much! this has bothered me for a while and only now did i think to search for solutions. this is going to really help me.
    i just don’t hope i now get in the habit of pressing ctrl+q often, because i switch back and forth between PC and mac – trading one problem for another!! πŸ™‚

  55. I was about to lost a large amount of work because of this stupid ctrl + s. Fortunately, I came accross your topic. Thanks a loooot !
    It worth far more than one banana, 21 I’d say πŸ™‚

  56. Ramm, this is a true life saver…, thank you for posting this article.
    It hung the putty completely when I pressed ctrl s , instead of ctrl a, by mistake from a screen session. After hours of struggle, as dont wanted to close it , I thought lets google it, and first page I came across is yours. And it FIXED the issue with Ctrl q , wow! , Thanks a lot helped. Raj.

  57. Thanks a lot Raam… Now at least I don’t have the problem in switching between windows and unix as often as I have to do..

  58. +1 again! At least it’s been a year and a half since I last had to research this (and comment on your post). Different server, so I didn’t have the .bashrc fix from last time. At least I recognized immediately what I’d done – just couldn’t remember the Ctrl-Q key combo. Thanks, AGAIN, for this sanity-saving post!

  59. The cure for the habitual windows keyboard jockey.

    Already used five times today. πŸ™‚ Thank you!

  60. Thanks Raam., I am clueless., after hitting ctr+s., I thought my session got crashed. With your help ctrl+q, not is resolved.

  61. Thanks Raam for this post. I’d pressed Ctrl+S while a system file was edited (VI), the last thing I wanted to do was to terminate the session. Thanks so much !

  62. Thank you soooo much! I have shut down so many putty sessions this past two weeks (I am new to putty and am so automatic hitting CTRL-S to save because I have fallen victim to losing data too often).

    I knew that there had to be some simple explanation. Looks like you have been helping people with this solution for a long time! Again, many thanks!


  63. This continues to help people πŸ™‚
    I was not even aware of the habit which I had imported to VIM – found this post while looking to find out why VIM collapse so many times during Putty. I guess I should have read this one back in 2008!

  64. Yes this post was useful. Sometimes I press Ctrl + S in PUTTY and have to reconnect to my Linux machine. This helps avoid that. Thanks a lot.

  65. Yes thanks a million Raam ..finally this issue drove me over the edge today as I too am suffering from the “habitual windows save keystroke combination”.
    I’m also amazed at your dedication Raam for still responding to comments now even after starting this post nearly 8 years ago! Cheers Josh

  66. Yes thanks for that been bugging me for a long time and was never sure what had happened to putty i would just close it down and start it back up again, however it wasn’t until recently that my automatic crtl-s habit bugged me enough to search for a solution.

  67. Thanks a lot man, especially for the .bashrc snippet. Funny, this probablem just started to appear a month or so back, perhaps it was the console drivers or something which got an “upgrade”.


  68. Thank you for this. Like you I’m in the habit of typing Ctrl-S regularly in other programmes and, because I have two screens, sometimes I lose track of which programme I’m working in and start typing on the wrong screen. (Next fix – Get your computer to read your mind so it always knows to enter data in the programme you think you’re typing in?)

  69. Thank you! Thank you! Thank you! That was getting really annoying! You’ve saved me many a frustrating minute in recovery time!

  70. This is amazing thank you!

    For anyone else reading this, if you update your .bashrc and want to see the changes immediately without logging out and back in.

    source ~/.bashrc
    . ~/.bashrc

  71. Unbelievable!!! 10 years later i’m where you where at that point…
    I don’t know why this only stated to happen to me the last year, yet a big THANKS!!!!

    • Ha, it still surprises me that this post is still useful, after so many years. It sort of makes me wonder how many years from now this will still be useful! Gotta love the Internet! πŸ™‚

  72. Add me to the list of grateful readers. ctrl-w-s SHOULD split my vim window, but as soon as Putty catches the S, I’m doomed…

  73. It is happy to see a person who has same habit as me. I am always run another terminal to kill the vim when I press a Ctrl-s in a vim, until today, I could not endure the insolence of this. I ‘bing’ this topic, and see you what you met. Thanks for your solution.

  74. Sooooo Cooooool! Not only the fix, but the fact that you figured this out 13 years ago and your post is still saving people! And all those cool comments!

    Now that is one for the record books.

    Thanks for your help.

    • You’re most welcome, Joshua! Yes, it’s still incredible that this post is still helping people. It makes me wonder just how many more years this can go on. πŸ˜†


  • Return to the dark ages | IT procedures, tests and checks June 13, 2022
  • putty ssh vi ctrl s | Life in USA June 13, 2022
  • Putty δΈ­ηš„ Ctrl+s | ζ°΄ζ™―δΈ€ι‘΅ June 13, 2022
  • Ellis June 13, 2022
  • Niranj Vaidyanathan June 13, 2022
  • Soren Jones June 13, 2022
  • ι­”ιΊŸ Matthew Ruttley June 13, 2022
  • Bastian Widmer June 13, 2022
  • Noah Spahn June 13, 2022
  • Juan Ara MonzΓ³n June 13, 2022
  • Murat June 13, 2022
  • Murat June 13, 2022
  • Albert Baldassarre June 13, 2022
  • Chris Schuld June 13, 2022
  • Eric Leschinski June 13, 2022
  • KRRS June 13, 2022
  • Ronald Lukassen June 13, 2022
  • June 13, 2022
  • codestem June 13, 2022
  • Marc Climent June 13, 2022
  • Jonas Giehl June 13, 2022
  • Logan R. June 13, 2022
  • David Hergert June 13, 2022
  • Recover from Ctrl-S in Putty/SecureCRT | Ramblings of a Misplaced Southerner June 13, 2022
  • Putty help - Multiplay Forums June 13, 2022
  • AJ Simpkin June 13, 2022
  • junichi_y June 13, 2022
  • AndrΓ© Norbim June 13, 2022
  • みはbot June 13, 2022
  • Indigo June 13, 2022
  • Rajesh Kumar June 13, 2022
  • Michael Carriere June 13, 2022
  • Joy June 13, 2022
  • cl4es June 13, 2022
  • Death of the Terminal Session | Adam Poirier June 13, 2022