Chapter 29.
Command Line Editing
This chapter describes the basic features of the gnu command line editing interface.
29.1. Introduction to Line Editing
The following paragraphs describe the notation used to represent keystrokes.
The text
C-k
is read as ‘Control-K’ and describes the character produced when the [k] key is pressed
while the Control key is depressed.
The text
M-k
is read as ‘Meta-K’ and describes the character produced when the Meta key (if you
have one) is depressed, and the [k] key is pressed. The Meta key is labeled [ALT] on many keyboards.
On keyboards with two keys labeled [ALT] (usually to either side of the space bar), the [ALT] on the
left side is generally set to work as a Meta key. The [ALT] key on the right may also be configured to
work as a Meta key or may be configured as some other modifier, such as a Compose key for typing
accented characters.
If you do not have a Meta or [ALT] key, or another key working as a Meta key, the identical keystroke
can be generated by typing [ESC]
first
, and then typing [k]. Either process is known as
metafying
the
[k] key.
The text
M-C-k
is read as ‘Meta-Control-k’ and describes the character produced by
metafying
C-k
.
In addition, several keys have their own names. Specifically, [DEL], [ESC], [LFD], [SPC], [RET], and
[TAB] all stand for themselves when seen in this text, or in an init file (refer to Section 29.3
Readline
Init File
). If your keyboard lacks a [LFD] key, typing [C-j] will produce the desired character. The
[RET] key may be labeled [Return] or [Enter] on some keyboards.
29.2. Readline Interaction
Often during an interactive session you type in a long line of text, only to notice that the first word on
the line is misspelled. The Readline library gives you a set of commands for manipulating the text as
you type it in, allowing you to just fix your typo, and not forcing you to retype the majority of the line.
Using these editing commands, you move the cursor to the place that needs correction, and delete or
insert the text of the corrections. Then, when you are satisfied with the line, you simply press [RET].
You do not have to be at the end of the line to press [RET]; the entire line is accepted regardless of the
location of the cursor within the line.
29.2.1. Readline Bare Essentials
In order to enter characters into the line, simply type them. The typed character appears where the
cursor was, and then the cursor moves one space to the right. If you mistype a character, you can use
your erase character to back up and delete the mistyped character.
Sometimes you may mistype a character, and not notice the error until you have typed several other
characters. In that case, you can type
C-b
to move the cursor to the left, and then correct your mistake.
Afterwards, you can move the cursor to the right with
C-f
.
When you add text in the middle of a line, you will notice that characters to the right of the cursor are
‘pushed over’ to make room for the text that you have inserted. Likewise, when you delete text behind
the cursor, characters to the right of the cursor are ‘pulled back’ to fill in the blank space created by
the removal of the text. A list of the bare essentials for editing the text of an input line follows.
Summary of Contents for ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Page 1: ...Red Hat Enterprise Linux 4 Debugging with gdb ...
Page 12: ...2 Chapter 1 Debugging with gdb ...
Page 28: ...18 Chapter 4 Getting In and Out of gdb ...
Page 34: ...24 Chapter 5 gdb Commands ...
Page 44: ...34 Chapter 6 Running Programs Under gdb ...
Page 68: ...58 Chapter 8 Examining the Stack ...
Page 98: ...88 Chapter 10 Examining Data ...
Page 112: ...102 Chapter 12 Tracepoints ...
Page 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Page 138: ...128 Chapter 14 Using gdb with Different Languages ...
Page 144: ...134 Chapter 15 Examining the Symbol Table ...
Page 170: ...160 Chapter 19 Debugging remote programs ...
Page 198: ...188 Chapter 21 Controlling gdb ...
Page 204: ...194 Chapter 22 Canned Sequences of Commands ...
Page 206: ...196 Chapter 23 Command Interpreters ...
Page 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Page 296: ...286 Chapter 27 gdb Annotations ...
Page 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Page 322: ...312 Chapter 30 Using History Interactively ...
Page 362: ...352 Appendix D gdb Remote Serial Protocol ...
Page 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Page 386: ...376 Appendix G GNU Free Documentation License ...
Page 410: ......