How often have you accidentally pressed ctrl+s and had your terminal frozen? I don't understand this default mapping at all. It should be gone from Linux installations. If you're a newbie you might have even thought that the terminal has died (I did think so, and I'd restart the terminal when that happened). Apparently you need to press ctrl+q to unfreeze the terminal. These keys could be used for something better than freezing and unfreezing the console.

Get rid of these keys by running these commands:

stty stop undef
stty start undef

Instead remap these combinations to something much more useful, such as saving the file in vim with ctrl+s.

Comments

May 20, 2014, 17:46

I use very often those freeze and unfreeze, it's great when you need to stop tailing logfile for moment and then continue. Also if you already use some key combinations it's hard to learn something other on those combinations.

Simon Permalink
May 21, 2014, 05:23

Absolutely... if I were to unmap those keys, I'd be losing valuable functionality from the terminal. And there's no point in re-using them for save in vim, because anyone who knows how to use vim isn't going to expect to use Ctrl+S to save...

May 21, 2014, 10:29

Really good points!

ILMostro Permalink
October 08, 2014, 04:39

For those who may want to map "C-s" to "Save" in vim, you can place the following in your ~/.bashrc file:

if [ -t 0 ]; then
stty ixany
fi

This works for me; though, I must admit, I barely ever use the shortcut, since it's so easy to simply type

:w

HELDON Permalink
May 20, 2014, 18:24

O jā, šits ir labs ieteikums! Ir gadījies "kaut ko" nospiežot nofrīzot konsoli. Tagad tu palīdzēji saprast, ko tieši nospiežot tas notiek :)

Translation:

This is great. It sometimes happens when I press "something" the console freezes. Now you helped to understand what exactly happens.

May 21, 2014, 10:31

Atceros :) Sigulda 29. jūnijs. Bildes vēl ir. :)

McCloud Permalink
May 21, 2014, 05:37

Yes - you could unmap tty stop/start but you should NEVER map Ctrl+s in vim if you ever use vim on another computer than yours.

May 21, 2014, 10:32

I'll never use another computer than mine. :)

May 21, 2014, 13:11

Interesting, though I use Linux whenever I can, my main system is OS X (BSD Unix with Bash shell). ctrl-s/-q do not freeze/unfreeze in my OS X bash environment.

July 08, 2014, 00:00

stty -ixon

also works for me.

sandy Permalink
April 04, 2015, 16:45

it's great when you need to stop tailing logfile for moment and then continue.

Leave a new comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "floppy_422": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.

Advertisements