Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To configure the Home and End keys in terminal on MacBook Air (OS X 10.7.2) I defined in Terminal -> Preferences -> Keyboard:

Key     Action
----    ------
Home    \033OH
End     \033OF

What are the codes to configure the following combinations so that they will work like in Windows?

  • Shift+Left (should select the character on the left)
  • Shift+Right (should select the character on the right)
  • Shift+Home (should select all the characters on the left)
  • Shift+End (should select all the characters on the right)
share|improve this question
You do realize that xterm and are not the same? – Daniel Beck Nov 18 '11 at 11:30
I'm not sure... Could you explain please? How does this help me to do the desired keybindings? – Misha Moroshko Nov 18 '11 at 11:52
It doesn't. But your question is misleading: There's absolutely no connection to xterm with what you want to do. – Daniel Beck Nov 18 '11 at 12:16
OK, I deleted xterm from the question. – Misha Moroshko Nov 18 '11 at 12:21
What kind of selection are we talking about, do you mean the terminal selection (when click and drag with the mouse), or the shell selection (when you press C-space). They are different. – Ammar Alammar Feb 1 '12 at 18:12

You can use the read command to determine the keybinding sequence followed by your required keys

Add the output to the below file prefixed with "\e[your sequence]"

Create a file in your home directory ~/ called .inputrc

$ vim ~/.inputrc

I have the following setup for ctrl + left , right, up, down and home and end keys

"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word

Restart and your good to go.

share|improve this answer
The question is about selection, not movement. – Daniel Beck Nov 18 '11 at 17:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.