The script command stores all terminal activities in a log file.
After executing the script command it starts recording everything printed on the screen including the inputs and outputs until exit.
By default, all the terminal information is saved in the file named typescript, if no argument is given.
script is mostly used when we want to capture the output of a command or a set of command while installing a program or the logs generated on the terminal while compiling an opensource codes, etc.