Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Why does fn-- (or others) do a home/end in Terminal but a - works everywhere else?

So just to be clear the question is how to make Terminal take Command + and for home and end?

share|improve this question

2 Answers 2

up vote 7 down vote accepted

As convenient as it would be, Terminal can't easily provide the functionality you ask for.

The reason is that other programs run inside Terminal, like bash (the standard shell) or vi (an editor), which have their own rules for moving the cursor to the beginning/end of the line, for example:

  • bash (and other shells) use CtrlA and CtrlE
  • vi uses 0 and $/Shift4

Other programs may use other keys. There isn't any universal key combination for positioning the cursor at the beginning/end of the line.

Of course, Terminal could maintain a list of key combinations for a number of common programs, check what's running and send the correct keys for you, or it could provide a menu item like Move Cursor To Beginning Of Line Inside Shell ⌘← and then send CtrlA behind the scenes. But I guess Apple engineers thought that if you venture in CLI territory you know its idiosyncrasies.

(Surprinsingly, Terminal provides Option and Option which behaves as you would expect, moving the cursor to the beginning of the previous/next word. That only works reliably in bash, in vi, for example, only the latter works.)

The closest you can get to the standard key combinations and is shift and shift. Go to Preferences...>Settings>[your active profile]>Keyboard:

enter image description here

press +, select "cursor left", "shift" as modifier and action "send string to shell". Then press CtrlA (\001 will appear in the text field`) and OK:

enter image description here

Now add a key combination for "cursor right" and press CtrlE. From now on you can use shift and shift as a poor man's and (notice that it will only work for programs that honor CtrlA/CtrlE).

I'd recommend, though, that you learn the specific key combinations of each program you use in Terminal.

share|improve this answer
Thanks for the detailed answer, is there a petition to just have Apple include a home/end button on the next redesign :-) –  Jackie Nov 12 '12 at 15:09
I'm glad I could help. –  jaume Nov 12 '12 at 15:22

Of course its possible.

First of all, you can use the free tool "DoubleCommand" if you have a windows keyboard with HOME/END keys to make'em behave like they should (beginning /end of line).

Secondly, for terminal specifically, go to the preferences, Keyboard, edit the icon/key which looks like an arrow pointing up-left, select "send text" and type ctrl+a. Done!

Same for the end button..

If you dont have a PC keyboard, you can do the same with other key combinations.

share|improve this answer

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.