# MacOS – Terminal problem with Ctrl + Arrow and Shift + Arrow keys

keyboardmacosterminal

I am running Mavericks on a new Macbook Pro. When I use the Ctrl and Shift keys together with the arrow keys, I get some sort of key codes as output in the terminal. I am pretty sure that this problem is new and that it didn't happen a few days ago. But I am not 100% sure. Anyway, this is what happens:

If I press Ctrl+ (Left arrow), ;5D is output in the terminal. Similarly:

• Ctrl+ (Right arrow) outputs ;5C
• Shift+ (Left arrow) outputs ;2D
• Shift+ (Right arrow) outputs ;2C

As I mentioned, I am pretty sure that before today I could use those shortcuts to move between words and select text. Has anyone seen this before? I have already looked through some of the existing questions about arrow key shortcuts, but I have found no references to this exact problem.

Also, note that I have turned off the keyboard shortcut that moves between desktops using the Ctrl + arrow keys.

If you want to use control-left and control-right to move between words in bash, add these lines to ~/.inputrc:
"\e[1;5C": forward-word

To use shift-arrows in Emacs, map shift-up to \e[1;2A, shift-down to \e[1;2B, shift-right to \e[1;2C, and shift-left to \e[1;2D. If pressing shift-up results in a message like <select> is undefined, try setting TERM to xterm-vt220.