-->

Previous | Table of Contents | Next

Page 31

transpose_chars (C_t) Drag the character before point forward over the character at point. Point moves forward as well. If point is at the end of the line, then transpose the two characters before point. Negative arguments don't work.
transpose_words (M_t) Drag the word behind the cursor past the word in front of the cursor, moving the cursor over that word as well.
upcase_word (M_u) Uppercase the current (or following) word. With a negative argument, do the previous word, but do not move point.
downcase_word (M_l) Lowercase the current (or following) word. With a negative argument, do the previous word, but do not move point.
capitalize_word (M_c) Capitalize the current (or following) word. With a negative argument, do the previous word, but do not move point.

Killing and Yanking

kill_line (C_k) Kill the text from the current cursor position to the end of the line.
backward_kill_line (C_x C_Rubout) Kill backward to the beginning of the line.
UNIX_line_discard (C_u) Kill backward from point to the beginning of the line.
kill_whole_line Kill all characters on the current line, no matter where the cursor is. By default, this is unbound.
kill_word (M_d) Kill from the cursor to the end of the current word, or if between words, to the end of the next word. Word boundaries are the same as those used by forward_word.
backward_kill_word (M_Rubout) Kill the word behind the cursor. Word boundaries are the same as those used by backward_word.
UNIX_word_rubout (C_w) Kill the word behind the cursor, using whitespace as a word boundary. The word boundaries are different from backward_kill_word.
delete_horizontal_space Delete all spaces and tabs around point. By default, this is unbound.
yank (C_y) Yank the top of the kill ring into the buffer at the cursor.
yank_pop (M_y) Rotate the kill_ring, and yank the new top. Only works following yank or yank_pop.

Numeric Arguments

digit_argument (M_0, M_1, ..., M—) Add this digit to the argument already accumulating, or start a new argument. M— starts a negative argument.
universal_argument Each time this is executed, the argument count is multiplied by four. The argument count is initially one, so executing this function the first time makes the argument count four. By default, this is not bound to a key.

Completing

complete (TAB) Attempt to perform completion on the text before point. Bash attempts completion treating the text as a variable (if the text begins with $), username (if the text begins with ~), hostname (if the text begins with @), or command (including aliases and functions) in turn. If none of these produces a match, filename completion is attempted.
possible_completions (M-?) List the possible completions of the text before point.
insert_completions Insert all completions of the text before point that would have been generated by possible_completions. By default, this is not bound to a key.
complete_filename (M_/) Attempt filename completion on the text before point.
								continues

Page 32

Completing

possible_filename_completions (C_x /) List the possible completions of the text before point, treating it as a filename.
complete_username (M_~) Attempt completion on the text before point, treating it as a username.
possible_username_completions (C_x ~) List the possible completions of the text before point, treating it as a username.
complete_variable (M_$) Attempt completion on the text before point, treating it as a shell variable.
possible_variable_completions (C_x $) List the possible completions of the text before point, treating it as a shell variable.
complete_hostname (M_@) Attempt completion on the text before point, treating it as a hostname.
possible_hostname_completions (C_x @) List the possible completions of the text before point, treating it as a hostname.
complete_command (M_!) Attempt completion on the text before point, treating it as a command name. Command completion attempts to match the text against aliases, reserved words, shell functions, builtins, and finally executable filenames, in that order.
possible_command_completions (C_x !) List the possible completions of the text before point, treating it as a command name.
dynamic_complete_history (M-TAB) Att empt completion on the text before point, comparing the text against lines from the history list for possible completion matches.
complete_into_braces (M_{) Perform filename completion and return the list of possible completions enclosed within braces so the list is available to the shell. (See "Brace Expansion," earlier in this manual page.)

Keyboard Macros

start_kbd_macro (C-x () Begin saving the characters typed into the current keyboard macro.
end_kbd_macro (C-x )) Stop saving the characters typed into the current keyboard macro and save the definition.
call_last_kbd_macro (C-x e) Re-execute the last keyboard macro defined, by making the characters in the macro appear as if typed at the keyboard.

Miscellaneous

re_read_init_file (C_x C_r) Read in the contents of your init file, and incorporate any bindings or variable assignments found there.
abort (C_g) Abort the current editing command and ring the terminal's bell (subject to the setting of bell_style).
do_uppercase_version (M_a, M_b, ...) Run the command that is bound to the corresponding uppercase character.
prefix_meta (ESC) Metafy the next character typed. ESC-f is equivalent to Meta_f.
undo (C-_, C_x C_u) Incremental undo, separately remembered for each line.
revert_line (M_r) Undo all changes made to this line. This is like typing the undo command enough times to return the line to its initial state.
tilde_expand (M_~) Perform tilde expansion on the current word.
dump_functions Print all of the functions and their key bindings to the readline output stream. If a numeric argument is supplied, the output is formatted in such a way that it can be made part of an inputrc file.
display_shell_version (C_x C_v) Display version information about the current instance of bash.
emacs_editing_mode (C_e) When in vi editing mode, this causes a switch to emacs editing mode.

HISTORY

When interactive, the shell provides access to the command history, the list of commands previously typed. The text of the last HISTSIZE commands (default 500) is saved in a history list. The shell stores each command in the history list prior to

Page 33

parameter and variable expansion (see "Expansion," earlier in this manual page) but after history expansion is performed, subject to the values of the shell variables command_oriented_history and HISTCONTROL. On startup, the history is initialized from the file named by the variable HISTFILE (default ~/.bash_history). HISTFILE is truncated, if necessary, to contain no more than HISTFILESIZE lines. The built-in command fc (see Shell Built-in Commands, later in this manual page) may be used to list or edit and re-execute a portion of the history list. The history builtin can be used to display the history list and manipulate the history file. When using the command-line editing, search commands are available in each editing mode that provide access to the history list. When an interactive shell exits, the last HISTSIZE lines are copied from the history list to HISTFILE. If HISTFILE is unset, or if the history file is unwritable, the history is not saved.

HISTORY EXPANSION

The shell supports a history expansion feature that is similar to the history expansion in csh. This section describes what syntax features are available. This feature is enabled by default for interactive shells, and can be disabled using the H option to the set built-in command. (See "Shell Built-in Commands," later in this manual page.) Noninteractive shells do not perform history expansion.

History expansion is performed immediately after a complete line is read, before the shell breaks it into words. It takes place in two parts. The first is to determine which line from the previous history to use during substitution. The second is to select portions of that line for inclusion into the current one. The line selected from the previous history is the event, and the portions of that line that are acted upon are words. The line is broken into words in the same fashion as when reading input, so that several meta character_separated words surrounded by quotes are considered as one word. Only the backslash (\) and single quotes can quote the history escape character, which is ! by default.

The shell allows control of the various characters used by the history expansion mechanism. (See the description of histchars under "Shell Variables," earlier in this manual page.)

EVENT DESIGNATORS

An event designator is a reference to a command line entry in the history list.

! Start a history substitution, except when followed by a blank, newline, =, or (.
!! Refer to the previous command. This is a synonym for !_1.
!n Refer to command line n.
!_n Refer to the current command line minus n.
!string Refer to the most recent command starting with string.
!?string[?] Refer to the most recent command containing string.
^string1^string2^ Quick substitution. Repeat the last command, replacing string1 with string2. Equivalent to !!:s/string1/string2/. (See "Modifiers," later in this manual page.)
!# The entire command line typed so far.

WORD DESIGNATORS

A colon (:) separates the event specification from the word designator. It can be omitted if the word designator begins with a ^, $, *, or %. Words are numbered from the beginning of the line, with the first word being denoted by a 0 (zero).

0 (zero) The zeroth word. For the shell, this is the command word.
n The nth word.
^ The first argument. That is, word 1.
$ The last argument.
% The word matched by the most recent ?string? search.
x_y A range of words; _y abbreviates 0_y.
* All of the words but the zeroth. This is a synonym for 1_$. It is not an error to use * if there is just one word in the event; the empty string is returned in that case.
x* Abbreviates x_$.
x_ Abbreviates x_$ like x*, but omits the last word.

Previous | Table of Contents | Next