MacOS – ctrl-o behavior in Terminal.app

keyboardmacosterminal

I often use the +O shortcut in bash (from "Learning the bash Shell"):

[G]o back to [a command in history] and press +O instead of . This will execute the command and bring up the next command in the history file. Press +O again to enter this command and bring up the next one.

It seems this shortcut is not available on OS X; +O simply does nothing. A web search turns up the suggestion to use the ! bash builtin, but I don't see how I can accomplish the same thing as +O with it.

Is it possible to somehow get +O behavior in Terminal.app on OS X?

Best Answer

+O is, for some reason (probably having to do with it being used for flow control on some kinds of serial connections) set to be discarded by the terminal driver (i.e. not Terminal.app, but the part of the OS between it and the shell). You can get rid of this with the command stty discard undef. To make this change permanent, add this command to your .bash_profile and .bashrc files.