Readline Vi Editing Mode Cheat Sheet Default Keyboard Shortcuts For Bash Page 2

ADVERTISEMENT

Deletion Commands:
x
Delete a single character under the cursor.
X
Delete a character before the cursor.
d movement command
Delete text of a movement command
movement command
(see above).
D
Delete to the end of the line (equivalent to d$).
dd
Delete current line (equivalent to 0d$).
CTRL-w
Delete the previous word.
CTRL-u
Delete from the cursor to the beginning of line.
Undo, Redo and Copy/Paste Commands:
u
Undo previous text modification.
U
Undo all previous text modifications on the line.
.
Redo the last text modification.
y movement command
Yank a movement into buffer (copy).
yy
Yank the whole line.
p
Insert the yanked text at the cursor (paste).
P
Insert the yanked text before the cursor.
Commands for Command History:
k
Move backward one command in history.
j
Move forward one command in history.
G
Move to the history line
(you may specify the argument
by typing it on number
keys, for example, 15G).
/string or CTRL-r
Search history backward for a command matching
.
?string or CTRL-s
Search history forward for a command matching
(remember that on most
machines CTRL-s stops the output to the terminal (CTRL-q starts output) and you
might need to change it with stty command).
n
Repeat search in the same direction as previous.
N
Repeat search in the opposite direction as previous.
Completion Commands:
TAB or CTRL-i or =
List possible completions.
*
Insert all possible completions.
Miscellaneous Commands:
Invert the case of the character under cursor, and move a character right.
#
Prepend # (comment character) to the line and send it to the history list.
Inserts the n-th word of the previous command in the current line.
0, 1, 2, ...
Sets the numeric argument.
CTRL-v
Insert a character literally (quoted insert).
CTRL-t
Transpose (exchange) two characters.
Examples and Tips
Some of the commands take a
movement command . These commands apply the movement to themselves.
For example, d$ would use $ as a movement, which moves the cursor to the end of the line, thus, the whole d$
would delete text from the current cursor position to the end of the line. Another example, a command cfA would
use fA as a movement, which finds the next occurance of the character A, thus, the whole command would change
the line up to character A.
Use CTRL-v to insert character literally, for example, CTRL-v CTRL-r would insert CTRL-r in the command
line.
See man bash, man readline, and built in bind command for modifying the default behavior!
A cheat sheet by Peteris Krumins (peter@catonmat.net), 2008.
- good coders code, great reuse
Released under GNU Free Document License.

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 2