1SCRIPT(1) User Commands SCRIPT(1)
2
3
4
6 script - make typescript of terminal session
7
9 script [options] [file]
10
12 script makes a typescript of everything printed on your terminal. It
13 is useful for students who need a hardcopy record of an interactive
14 session as proof of an assignment, as the typescript file can be
15 printed out later with lpr(1).
16
17 If the argument file is given, script saves all dialogue in file. If
18 no file name is given, the typescript is saved in the file typescript.
19
21 -a, --append
22 Append the output to file or typescript, retaining the prior
23 contents.
24
25 -c, --command command
26 Run the command rather than an interactive shell. This makes it
27 easy for a script to capture the output of a program that
28 behaves differently when its stdout is not a tty.
29
30 -e, --return
31 Return the exit code of the child process. Uses the same format
32 as bash termination on signal termination exit code is 128+n.
33
34 -f, --flush
35 Flush output after each write. This is nice for telecoopera‐
36 tion: one person does `mkfifo foo; script -f foo', and another
37 can supervise real-time what is being done using `cat foo'.
38
39 --force
40 Allow the default output destination, i.e. the typescript file,
41 to be a hard or symbolic link. The command will follow a sym‐
42 bolic link.
43
44 -q, --quiet
45 Be quiet.
46
47 -t, --timing[=file]
48 Output timing data to standard error, or to file when given.
49 This data contains two fields, separated by a space. The first
50 field indicates how much time elapsed since the previous output.
51 The second field indicates how many characters were output this
52 time. This information can be used to replay typescripts with
53 realistic typing and output delays.
54
55 -V, --version
56 Output version information and exit.
57
58 -h, --help
59 Output help and exit.
60
62 The script ends when the forked shell exits (a control-D to exit the
63 Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is
64 not set) for the C-shell, csh(1)).
65
66 Certain interactive commands, such as vi(1), create garbage in the
67 typescript file. Script works best with commands that do not manipu‐
68 late the screen, the results are meant to emulate a hardcopy terminal.
69
71 The following environment variable is utilized by script:
72
73 SHELL If the variable SHELL exists, the shell forked by script will be
74 that shell. If SHELL is not set, the Bourne shell is assumed.
75 (Most shells set this variable automatically).
76
78 csh(1) (for the history mechanism), scriptreplay(1).
79
81 The script command appeared in 3.0BSD.
82
84 Script places everything in the log file, including linefeeds and
85 backspaces. This is not what the naive user expects.
86
88 The script command is part of the util-linux package and is available
89 from Linux Kernel Archive ⟨ftp://ftp.kernel.org/pub/linux/utils/util-
90 linux/⟩.
91
92
93
94util-linux September 2011 SCRIPT(1)