The history command is a great command-line utility that helps users to store the previous command used, though it does not store the output of a command.
Originally Published at How to Record and Replay Linux Terminal Sessions using 'script' and 'scriptreplay' Commands