Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

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

1 Answer 1

up vote 12 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
1  
More Readline keybindings: tiswww.case.edu/php/chet/readline/rluserman.html 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 Terminal.app ... 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 terminal.app, there are ways to adjust your terminal.app 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

Your Answer

 
discard

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.