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.

I use a Mac, so I don't have Home and End keys on my keyboard. I also SSH to Linux servers quite a bit. I've found that when I SSH to an Ubuntu Linux server running Jaunty I can use the readline key-bindings Ctrl-a and Ctrl-e to move the cursor to the beginning or the end of the line, but there are a couple of Hardy servers I often SSH to, and those key-bindings don't work when connecting to them.

I've tried connecting to them from a Linux box instead, just in case it was something to do with the way my Mac Terminal is configured, and I see the same results.

Does anyone have any idea why, and how to fix this?

share|improve this question

2 Answers 2

up vote 9 down vote accepted

Just a thought, but try entering this and retrying the commands:

set -o emacs

If that works, put the setting in your ~/.bashrc file to load it automatically.

If you prefer vi(m), you can do this:

set -o vi

Note, however, that the vi-bindings aren't nearly as complete as the emacs ones.

share|improve this answer

Found the answer! /etc/bash.bashrc had set -o vi in it, which for some reason was preventing Ctrl-e and Ctrl-a from working.

share|improve this answer
2  
The set -o vi command causes Bash to use Vim bindings. The default is Emacs style bindings. So, it's not "for some reason," but rather that set -o vi invokes a whole different set of Readline options. See my answer for how to switch on the fly. –  Telemachus Sep 28 '09 at 16:58
    
Excellent, thanks. I realised that Bash was being set to use vi bindings, but didn't expect that to prevent Ctrl-a and Ctrl-e from working. I'd not realised that the way to turn-off vi bindings was to set emacs bindings. –  Richard Turner Sep 30 '09 at 10:09

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.