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

On a Macbook Pro keyboard, how do you go the the end-of-line and beginning-of-line in

Note that Ctrl-a and Ctrl-e on this computer with default configuration does not work. They just echo "^A" and "^E"....

Terminal 2.1.1 ; Snow Leopard ; MacBookPro6,2

share|improve this question
One might think this is an established answer or a duplicate question, but every answer I've come across either does not work (perhaps only for the macbook pro keyboard), or doesn't clearly describe how to enter keyboard escape sequences, or is missing other crucial info or isn't expressed in simplest terms. – malatio Nov 27 '10 at 1:34
up vote 19 down vote accepted

Ctrl + a and Ctrl + e for beginning and end respectively.

Bonus: Ctrl + w deletes the previous word.

EDIT: As far as I can tell, you are using the zsh shell, which by default does not use Emacs key bindings. To get the behaviour you want, do the following during your session:

echo "bindkey -e" >> ~/.zshrc && source ~/.zshrc

You should be good to do. For more keybinding information, please check the relevant section from the Zsh manual.

share|improve this answer
More Readline keybindings: By default, these are mostly inspired by Emacs movement and editing shortcuts. – ephemient Nov 27 '10 at 3:52
That pesky Ctrl key confuses me when I'm switching between XP on VirtualBox, Mac OS X and ... but at least Ctrl + a and Ctrl + e is consistent across most terminals. +1 for you. – user3463 Nov 27 '10 at 4:24
I don't much like the use of Ctrl for this either, but I agree there's a reason to keep it this way instead of using Cmd. – xorbyte Nov 27 '10 at 4:53
Yeah this doesn't work on my new macbook pro running snow leopard. I get "^A" in the terminal when typing Ctrl-a, etc... So I'm still looking for the right answer :( – malatio Nov 29 '10 at 6:28
This really is the correct answer, check on your setup if it doesn't work -- in my case I was running zsh with some funny bindings. So not to be bash-centric, but be careful with your setup if you're not using default bash with the default .profile if this doesn't work. One note, I belive these are features of bash, not, there are ways to adjust your and/or os settings to select your own keycodes to send in to the terminal, but it all gets very complicated. – malatio Nov 30 '10 at 19:43

fn+ and fn+ work for me (they represent Home and End respectively).

More convenient than ctrl+A and ctrl+E in my opinion.

share|improve this answer
Really? That seems odd to me, since both fn and arrows are farther away from the center of the keyboard... but it doesn't exactly matter, since the question isn't "how do I type like Patrick?". ctrl-A and ctrl-E aren't widely used but have a following going way back; there's a contingent of bearded keyboardists who do use it. – malatio Mar 31 '15 at 20:54

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.