Take the 2-minute tour ×
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.

This question already has an answer here:

What is meant by "Enabling command line editing and vi and emacs editing modes"?

I know vi is an editor and have used it as well, but what and how is it related to command line editing bamboozles me. I am using bash shell and a Red Hat system essentially in command line mode to learn.

share|improve this question
add comment

marked as duplicate by slm, Bernhard, derobert, Anthon, jasonwryan Dec 30 '13 at 18:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers

Emacs and vi editing modes refer to how command line editing works with for example Bourne Again Shell (bash). By default emacs editing mode is in effect, but you can change this with set -o vi and then back again with set -o emacs.

For example, to move to the end of current command line you're editing, you'd use CTRL-E when in emacs mode and $ in vi editing mode.

See also man readline which tells you a little bit about the readline library working behind all this.

share|improve this answer
add comment

This refers to which keys to use to move move the cursor (and go to beginning of line, etc).

In vi mode use h (left), j (down), k (up), l (right)

In 'emacs mode use Ctrl+F (left), Ctrl+N (down), Ctrl+P (up), Ctrl+B (right)

share|improve this answer
add comment

The other answers are good, but just filling in a bit of background: Basically, this was an attempt to make command-line editing conform to the reflexes people had developed from using their preferred editor -- which at the time was almost always going to be either emacs or vi, both having rabid fans and detractors.

These days, with keyboards that have dedicated Home, End, cursor, page up/down, and insert/delete keys that all editors support more-or-less similarly, the editor-specific mappings are somewhat less used and this setting matters less than it did at the time.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.