February 2004
Beginner
200 pages
5h 40m
English
bash lets you edit the command line you’re working on, using keystrokes inspired by the text editors emacs and vi (see File Creation and Editing). To enable command-line editing with emacs keys, run this command (and place it in your ~/.bash_profile to make it permanent):
$ set -o emacs
For vi keys:
$ set -o vi
emacs keystroke | vi keystroke (first type ESC) | Meaning |
^P or up arrow | k | Previous command line |
^N or down arrow | j | Next command line |
^F or right arrow | l | Forward one character |
^B or left arrow | h | Backward one character |
^A | 0 | Beginning of line |
^E | $ | End of line |
^D | x | Delete next character |
^U | ^U | Erase entire line |