Script (Unix)
The script command is a Unix utility that records a terminal session. It dates back to the 1979 3.0 BSD. Usage. A script session is captured in file name by default; to specify a different filename follow the command with a space and the filename as such: . The recorded format of consists of plain-text timing information (for the whole session) and verbatim command output, including whatever ANSI escape code the program has printed for formatting. It uses a pseudoterminal for this purpose, so programs act exactly as if they were on a terminal. The util-linux command  offers a replay function to its script, which supports using an extra timing file for character-level information. Some online services, such as the now-defunct shelr.tv, can also show the format as a low-bandwidth alternative to video screencasts. Problems with "script". One of the problems with the script command is that it only allows logging of a child process; and often there is a need to log the command in the current process without spawning a new process, such as when automation of a script is needed that can log its own output. The Unix operating systems make  this possible by use of pipes and redirects. Consider the following model examples: All shells related to Bourne shell (namely: sh, bash, and ksh) allow the stdout and stderr to be attached to a named pipe and redirected to the tee command. Example LOGNAME="script" rm -f $LOGNAME.p $LOGNAME.log mknod $LOGNAME.p p tee <$LOGNAME.p $LOGNAME.log & exec >$LOGNAME.p 2>&1 The above script records to all output of the command. However, some interactive programs (such as python) do not echo their standard input when run under the resulting shell, although they do when run under  the script command, again due to the detection of a terminal. Alternatives to Script Command. The ttyrec program from 2000 provides the same kind of functionality and offers several bindings. The timing is similar to util-linux. A more modern take on the concept is "asciicast" JSON, used by asciinema.