Chapter 1
Basic editing operations
-
Move within the line
Ctrl + A
: move the cursor to the start of the lineCtrl + E
: move the cursor to the end of the line.Ctrl + B
: moving backward within a line.Ctrl + F
: moving forward within a line.Ctrl + Left arrow key
: moves backward a word at a time, as does pressingEsc
and thenB
orF
.Ctrl + Right arrow key
: moves forward a word at a time.
-
Delete text
Ctrl + D/Delete
: deletes the character under the cursor, whereas pressing the Backspace key deletes the character to the left of the cursor.Ctrl + K
: deletes all text from the cursor to the end of the line.Ctrl + X + Backspace
: deletes all the text from the cursor to the beginning of the line.
-
Transpose text
Ctrl + T
: transposes the character before the cursor with the character under the cursor.Esc
and thenT
transposes the two words immediately before (or under) the cursor.
-
Invoke an editor to edit command
Ctrl + X
followed byCtrl + E
. The bash shell attempts to launch the editor defined by the$FCEDIT
or$EDITOR
environment variable or Emacs as a last resort.- Start editing your command, when you are done, save and exit to the terminal.
- The edited command is run automatically.