Ref: http://www.linuxjournal.com/node/8361/print vi or Emacs Mode in the Shell By default, the bash shell already should be in Emacs mode. You can use Ctrl-P and Ctrl-N instead of the up and down arrow keys to scroll through the command history. You can use other Emacs keystrokes to edit command lines. To make bash use vi keys, edit a file called .inputrc in your home directory and insert these lines: set editing-mode vi set keymap vi-insert Then, start up a fresh bash shell and try it out. If you press the Esc key, you enable editing mode, where hjkl keys work as left, down, up and right arrow keys. Other vi commands, including ^ for jump to start of line and $ for jump to end of line, also work. If your system defaults to vi and you want Emacs mode, insert these lines in your .inputrc file: set editing-mode emacs set keymap emacs These features come courtesy of the GNU Readline Library. For more information on Readline and its features, run man 3 readline or check the Readline Web site (cnswww.cns.cwru.edu/php/chet/readline/rltop.html [2]). Not only bash but any program that uses the GNU Readline Library can be customized by making changes to your .inputrc file. For example, the GDB debugger uses Readline. If you use the tcsh shell, again Emacs mode is available by default. You can set vi editing mode by placing this line in your .tcshrc file: bindkey -v Read the tcsh man page for more information. If you use the zsh shell, all you have to do is set the EDITOR or VISUAL environment variable to your favorite editor. If your choice contains the string "vi", zsh sets vi mode; otherwise it defaults to Emacs mode. You also directly can manage the editing mode with zsh's bindkey command. See the zsh man page for more information. Even the Midnight Commander (mc) file manager supports Emacs-style command-line editing as well as Emacs-like and vi-like key bindings in its file viewer. Steve R. Hastings first used UNIX on actual paper teletypes. He enjoys bicycling with his wife, listening to music, petting his cat and making his Linux computers do new things.