Since it is often necessary to show test cases for programs that students develop,
and since that output may involve more lines than the terminal buffer will hold, it
is often necessary to use a small text-capturing program. One of the easiest programs
to use is
script. The only argument to the program is the filename for the output.
While the output filename is optional, it is better to specify a file than to use the
default file, as data may be overwritten if you've already stored data in it. To start
the capture program, use the following command to store output to the file "output.txt":
The capture program will record all keystrokes and program output that occur either until
the terminal window is closed, or the command
exit is issued. Issuing the
exit
command will close the
script program and save the output session to the specified file.