script command is used to make a typescript or record of everything printed on your terminal. It is useful for anyone who need a hardcopy record of an interactive session as proof and the typescript file can be printed out with lpr command.
script — Start the recording in a default file. i.e typescript
script — Start the recording in specified file name
script -a — Start the recording in append mode
Ctrl+d — Stop the recording
Use cat command to open the file.
For more see the command’s man page.