You may want to save the output of gdb commands to a file. There are several commands to control gdb's logging.
set logging on
set logging off
set logging file
fileset logging overwrite [on|off]
overwrite
if
you want set logging on
to overwrite the logfile instead.
set logging redirect [on|off]
redirect
if you want output to go only to the log file.
show logging