Function Reference
— Command: history options

If invoked with no arguments, history displays a list of commands that you have executed. Valid options are:

-w file
Write the current history to the file file. If the name is omitted, use the default history file (normally ~/.octave_hist).
-r file
Read the file file, replacing the current history list with its contents. If the name is omitted, use the default history file (normally ~/.octave_hist).
n
Only display the most recent n lines of history.
-q
Don't number the displayed lines of history. This is useful for cutting and pasting commands if you are using the X Window System.

For example, to display the five most recent commands that you have typed without displaying line numbers, use the command history -q 5.