How to swap Ctrl and Alt in just the Terminal

keyboardterminal

I have a USB keyboard where I swapped my Cmd and Ctrl keys, because I come from the world of Linux and that's just what I'm used to.

However, this causes a problem in the Terminal because all of a sudden the Ctrl key (used for escapes and whatnot [^C, ^D, and so on]) is in the wrong place. As a result, I keep accidentally pressing the wrong key.

Is there a way to swap my Cmd and Ctrl keys again only in Terminal (so that the keys are all in the right place)?

Best Answer

iTerm2 will let you remap your modifier keys. This has the effect of just remapping them for terminals. Bonus: it's also a better terminal program for OS X than the built-in Terminal.app that ships with OS X.

You can alter the modifier keys on a per-profile basis as well. That lets you switch profiles for terminals depending on what you're doing with the terminal so you get the correct behaviour for local and remote sessions.

iTerm2 modifier mappings