script makes a typescript of everything displayed on your terminal.
It is useful for students who need a hardcopy record of an
interactive session as proof of an assignment, as the typescript file
can be printed out later with lpr(1).
If the argument file is given, script saves the dialogue in this
file. If no filename is given, the dialogue is saved in the file
Append the output to file or to typescript, retaining the
-c, --command command
Run the command rather than an interactive shell. This makes
it easy for a script to capture the output of a program that
behaves differently when its stdout is not a tty.
Return the exit code of the child process. Uses the same
format as bash termination on signal termination exit code is
Flush output after each write. This is nice for
telecooperation: one person does `mkfifo foo; script -f foo',
and another can supervise real-time what is being done using
Allow the default output destination, i.e. the typescript
file, to be a hard or symbolic link. The command will follow
a symbolic link.
Be quiet (do not write start and done messages to either
standard output or the typescript file).
Output timing data to standard error, or to file when given.
This data contains two fields, separated by a space. The
first field indicates how much time elapsed since the previous
output. The second field indicates how many characters were
output this time. This information can be used to replay
typescripts with realistic typing and output delays.
Display version information and exit.
Display help text and exit.
The script ends when the forked shell exits (a control-D for the
Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is
not set) for the C-shell, csh(1)).
Certain interactive commands, such as vi(1), create garbage in the
typescript file. script works best with commands that do not
manipulate the screen, the results are meant to emulate a hardcopy
It is not recommended to run script in non-interactive shells. The
inner shell of script is always interactive, and this could lead to
unexpected results. If you use script in the shell initialization
file, you have to avoid entering an infinite loop. Use e. g. profile
file, which is read by login shells only:
if test -t 0 ; then
You should also avoid use of script in command pipes, as script can
read more input than you would expect.
The following environment variable is utilized by script:
SHELL If the variable SHELL exists, the shell forked by script will
be that shell. If SHELL is not set, the Bourne shell is
assumed. (Most shells set this variable automatically).
This page is part of the util-linux (a random collection of Linux
utilities) project. Information about the project can be found at
⟨https://www.kernel.org/pub/linux/utils/util-linux/⟩. If you have a
bug report for this manual page, send it to
email@example.com. This page was obtained from the
project's upstream Git repository
2015-02-21. If you discover any rendering problems in this HTML ver‐
sion of the page, or you believe there is a better or more up-to-date
source for the page, or you have corrections or improvements to the
information in this COLOPHON (which is not part of the original man‐
ual page), send a mail to firstname.lastname@example.org
util-linux June 2014 SCRIPT(1)