The background for this question: I currently have to do a lot of my work in terminal over ssh, and I use screen quite a bit. Because I found the ctrl-a key binding for screen commands so annoying since I'm accustomed to using ctrl-a to go to the beginning of a line, I changed it to ctrl-z. The only problem with this is that when I'm in Matlab, think I am in Screen but am not, pressing ctrl-z will instantly kill my Matlab session, because ctrl-z is the key binding for suspending processes in *nix.
So the question is: can I remove the key binding for ctrl-z in my shell so that it does no longer suspend a process?
My shell is terminal.app on OSX.
Best Answer
The ^Z binding is not configured in the shell, but in your TTY, the pseudo-device that lets you talk to the physical terminal or, as is typical nowadays, to a terminal emulator program. The TTY carries settings that tell the kernel how to react to keyboard input reported by the device or emulator.
Settings are changed using the
stty
command:stty
accepts a setting name and its value; in this case the setting name issusp
for key that suspends the process, and the value is a key combination, such as ^P. Typestty -a
or refer toman stty
for a list of available settings.