Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I find Bash keyboard shortcuts such as Ctrl-a (jump to start of line), Ctrl-k (cut text following caret), Ctrl-n/Ctrl-p (next/previous line in command history) immeasurably useful in day-to-day CLI work.

It's a shame that these shortcuts don't work when SSH'd into a remote xterm.

Is there a way to enable these shortcuts over SSH?

share|improve this question
These commands should work over SSH. What happens if you set -o emacs? – Chris Down Nov 13 '12 at 14:16
And ps $$? It might not even be bash. (ksh and zsh default to vi bindings if EDITOR=vi.) – Mikel Nov 13 '12 at 14:41
up vote 1 down vote accepted

Editing command line (including shortcuts) is a feature of a shell, not a terminal emulator (for the most part). So just put bash into emacs mode on a remote xterm:

$ set -o emacs
share|improve this answer
This works like a charm, sincere thanks. – KomodoDave Nov 13 '12 at 15:07

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.