Interactive crash commands are gathered using the GNU readline library,
which implements a command line history mechanism, and a command line editing
The command line history consists of a numbered list of previously run
commands, which can be viewed by entering "h" at any time. A previously
run command can be re-executed in a number of manners:
1. To re-execute the last command, enter "r" alone, or "!!".
2. Enter "r" followed by the number identifying the desired command.
3. Enter "r" followed by a uniquely-identifying set of characters from
the beginning of the desired command string.
4. Recycle back through the command history list by hitting the up-arrow
key until the desired command is re-displayed, and then hit <ENTER>.
If you go too far back, hit the down-arrow key.
The command line editing mode can be set to emulate either vi or emacs.
The mode can be set in the following manners, listed in increasing order of
1. The setting of the EDITOR environment variable.
2. An entry in either in a .crashrc file, which can be located either
in the current directory or in your home directory. The entry must
be of the form "set vi" or "set emacs".
3. By use of the crash "-e" command line option, as in "-e vi" or "-e emacs".
To edit a previously entered command:
1. Recycle back through the command history list until the desired command
2. Edit the line using vi or emacs editing commands, as appropriate.
3. Hit <ENTER>.
It should be noted that command line re-cycling may be accomplished by using
the CTRL-p and CTRL-n keys instead of the up- and down-arrow keys; in vi mode
you can enter <ESC>, then "k" to cycle back, or "j" to cycle forward.
A set of crash commands may be entered into a regular file that can be used as
input, using standard command line syntax:
crash> < inputfile
An input file may be also be run from the crash command line using the -i
$ crash -i inputfile
Alternatively, an input file containing command arguments may be created.
The arguments in the input file will be passed to the command specified,
which will be executed repetetively for each line of arguments in the file:
crash> ps -p < inputfile
Lastly, if a command is entered that is not recognized, it is checked against
the kernel's list of variables, structure, union or typedef names, and if
found, the command is passed to p, struct, union or whatis. That being the
case, as long as a kernel variable/structure/union name is different than any
of the current commands, the appropriate command above will be executed. If
not, the command will be passed on to the built-in gdb command for execution.
If an input line starts with "#" or "//", then the line will be saved
as a comment that is visible when re-cycling through the history list.