fc [ -e ename ] [ -nlrdDfEim ] [ old=new ... ] [ first [ last ] ]
or
fc -ARWI [ filename ]
Select a range of commands from first to last from the history list. The arguments first
and last
may be specified as a number or as a string. A negative number is used as an offset to the current history event number. A string specifies the most recent event beginning with the given string. All substitutions old=new
, if any, are then performed on the commands.
Option | Description |
---|---|
| The resulting commands are listed on standard output. |
| The first argument is taken as a pattern (should be quoted) and only the history events matching this pattern will be shown. |
| The editor program ename is invoked on a file containing these history events. If ename is not given, the value of the parameter |
| Reverse the order of the commands. |
| Suppresses command numbers when listing. |
| Prints timestamps for each command. |
| Prints full time-date stamps. |
| Causes the dates to be printed as |
| Causes the dates to be printed in ISO8601 |
| |
fc -R
: Reads the history from the given file.
fc -W
: Writes the history out to the given file.
fc -A
: Appends the history out to the given file.
If no filename is specified, the $HISTFILE
is assumed. If the -I
option is added to -R
, only those events that are not already contained within the internal history list are added. If the -I
option is added to -A
or -W
, only those events that are new since last incremental append/write to the history file are appended or written. In any case, the created file will have no more than $SAVEHIST
entries.
If first
is not specified, it will be set to -1
(the most recent event), or to -16
if the -l
flag is given. If last
is not specified, it will be set to first
, or to -1
if the -l
flag is given.