1SCRIPT(1) BSD General Commands Manual SCRIPT(1)
2
4 script — make typescript of terminal session
5
7 script [-a] [-c COMMAND] [-e] [-f] [-q] [-t] [file]
8
10 Script makes a typescript of everything printed on your terminal. It is
11 useful for students who need a hardcopy record of an interactive session
12 as proof of an assignment, as the typescript file can be printed out
13 later with lpr(1).
14
15 If the argument file is given, script saves all dialogue in file. If no
16 file name is given, the typescript is saved in the file typescript.
17
18 Options:
19
20 -a Append the output to file or typescript, retaining the prior con‐
21 tents.
22
23 -c COMMAND
24 Run the COMMAND rather than an interactive shell. This makes it
25 easy for a script to capture the output of a program that behaves
26 differently when its stdout is not a tty.
27
28 -e Return the exit code of the child process. Uses the same format
29 as bash termination on signal termination exit code is 128+n.
30
31 -f Flush output after each write. This is nice for telecooperation:
32 One person does `mkfifo foo; script -f foo' and another can
33 supervise real-time what is being done using `cat foo'.
34
35 -q Be quiet.
36
37 -t Output timing data to standard error. This data contains two
38 fields, separated by a space. The first field indicates how much
39 time elapsed since the previous output. The second field indi‐
40 cates how many characters were output this time. This information
41 can be used to replay typescripts with realistic typing and out‐
42 put delays.
43
44 The script ends when the forked shell exits (a control-D to exit the
45 Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is not
46 set) for the C-shell, csh(1)).
47
48 Certain interactive commands, such as vi(1), create garbage in the type‐
49 script file. Script works best with commands that do not manipulate the
50 screen, the results are meant to emulate a hardcopy terminal.
51
53 The following environment variable is utilized by script:
54
55 SHELL If the variable SHELL exists, the shell forked by script will be
56 that shell. If SHELL is not set, the Bourne shell is assumed.
57 (Most shells set this variable automatically).
58
60 csh(1) (for the history mechanism), scriptreplay(1).
61
63 The script command appeared in 3.0BSD.
64
66 Script places everything in the log file, including linefeeds and
67 backspaces. This is not what the naive user expects.
68
70 The script command is part of the util-linux-ng package and is available
71 from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
72
73Linux July 30, 2000 Linux