fc Command

The fc command manipulates the history list.

Syntax
fc (Fix Command) Invokes the editor ($FCEDIT) on the most recent command. The result is executed when you leave the editor. See ksh FCEDIT Environment Variable for more info.
fc -e editor Use editor instead of $FCEDIT to edit the previous command.
fc -l Lists the last 16 commands in the history.
fc -ln Lists the last 16 commands without history numbers.
fc -lr Lists the last 16 commands in reverse order.
fc -e - command Reexecute previous command that matches command. command may be a positive number (the history number), a negative number (subtracted from the current history number), a string (matches the most recent command starting with the given string), or nothing (meaning the previous command). The builtin alias r is set to fc -e -.
fc -e - old=new command Like the above, but substitutes new for old before executing the command
fc -e -g - old=new command Globally substitute new for old.

where:

editor is the name of an editor.

command is the name of a command.

new is a new value for an argument to command.

old is the value of an argument in the previous command that matches command.