1 .\" Copyright (c) 1980, 1990 Regents of the University of California.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)script.1 6.5 (Berkeley) 7/27/91
34 .TH SCRIPT "1" "June 2014" "util-linux" "User Commands"
36 script \- make typescript of terminal session
43 makes a typescript of everything displayed on your terminal. It is useful for
44 students who need a hardcopy record of an interactive session as proof of an
45 assignment, as the typescript file can be printed out later with
49 supports multiple streams and allows to log input and output to separate
50 files or all the one file.
54 or option \fB\-\-log\-out\fR \fIfile\fR is given,
56 saves the dialogue in this
58 If no filename is given, the dialogue is saved in the file
61 Below, the \fIsize\fR argument may be followed by the multiplicative
62 suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB
63 (the "iB" is optional, e.g. "K" has the same meaning as "KiB"), or the suffixes
64 KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.
66 \fB\-a\fR, \fB\-\-append\fR
71 retaining the prior contents.
73 \fB\-c\fR, \fB\-\-command\fR \fIcommand\fR
76 rather than an interactive shell. This makes it easy for a script to capture
77 the output of a program that behaves differently when its stdout is not a
80 \fB\-e\fR, \fB\-\-return\fR
81 Return the exit code of the child process. Uses the same format as bash
82 termination on signal termination exit code is 128+n. The exit code of
83 the child process is always stored in type script file too.
85 \fB\-f\fR, \fB\-\-flush\fR
86 Flush output after each write. This is nice for telecooperation: one person
87 does `mkfifo foo; script -f foo', and another can supervise real-time what is
88 being done using `cat foo'.
91 Allow the default output destination, i.e. the typescript file, to be a hard
92 or symbolic link. The command will follow a symbolic link.
94 \fB\-B\fR, \fB\-\-log\-io\fR \fIfile\fR
95 Log input and output to the same
96 \fIfile\fR. Note, this option makes sense only if \fB\-\-log\-timing\fR is
97 also specified, otherwise it's impossible to separate output and input streams from
100 \fB\-I\fR, \fB\-\-log\-in\fR \fIfile\fR
101 Log input to the \fIfile\fR. The log output is disabled if only \fB\-\-log\-in\fR
104 Use this logging functionality carefully as it logs all input, including input
105 when terminal has disabled echo flag (for example it log passwords in the input).
107 \fB\-O\fR, \fB\-\-log\-out\fR \fIfile\fR
108 Log output to the \fIfile\fR. The default is to log output to the file with
109 name 'typescript' if the option \fB\-\-log\-out\fR or \fB\-\-log\-in\fR is not
110 given. The log output is disabled if only \fB\-\-log\-in\fR specified.
112 \fB\-T\fR, \fB\-\-log\-timing\fR \fIfile\fR
113 Log timing information to the \fIfile\fR. Two timing file formats are supporte
114 now. The classic format is used when only one stream (input or output) logging
115 is enabled. The multi-stream format is used on \fB\-\-log\-io\fR or when
116 \fB\-\-log\-in\fR and \fB\-\-log\-out\fR are used together.
121 The log contains two fields, separated by a space. The first
122 field indicates how much time elapsed since the previous output. The second
123 field indicates how many characters were output this time.
125 .B Multi-stream format
127 The first field is entry type itentifier ('I'nput, 'O'utput, 'H'eader, 'S'ignal).
128 The socond field is how much time elapsed since the previous entry, and rest of the entry is type specific data.
131 \fB\-o\fR, \fB\-\-output-limit\fR \fIsize\fR
132 Limit the size of the typescript and timing files to
134 and stop the child process after this size is exceeded. The calculated
135 file size does not include the start and done messages that the
137 command prepends and appends to the child process output.
138 Due to buffering, the resulting output file might be larger than the specified value.
140 \fB\-q\fR, \fB\-\-quiet\fR
141 Be quiet (do not write start and done messages to standard output).
143 \fB\-t\fR[\fIfile\fR], \fB\-\-timing\fR[=\fIfile\fR]
144 Output timing data to standard error, or to
146 when given. This option is deprecated in favour of \fB\-\-log\-timing\fR where
147 the \fIfile\fR argument is not optional.
149 \fB\-V\fR, \fB\-\-version\fR
150 Display version information and exit.
152 \fB\-h\fR, \fB\-\-help\fR
153 Display help text and exit.
155 The script ends when the forked shell exits (a
170 Certain interactive commands, such as
172 create garbage in the typescript file.
174 works best with commands that do not manipulate the screen, the results are
175 meant to emulate a hardcopy terminal.
177 It is not recommended to run
179 in non-interactive shells. The inner shell of
181 is always interactive, and this could lead to unexpected results. If you use
183 in the shell initialization file, you have to avoid entering an infinite
184 loop. You can use for example the \fB\%.profile\fR file, which is read
185 by login shells only:
200 You should also avoid use of script in command pipes, as
202 can read more input than you would expect.
205 The following environment variable is utilized by
211 exists, the shell forked by
213 will be that shell. If
215 is not set, the Bourne shell is assumed. (Most shells set this variable
226 command appeared in 3.0BSD.
231 in the log file, including linefeeds and backspaces. This is not what the
235 is primarily designed for interactive terminal sessions. When stdin
236 is not a terminal (for example: \fBecho foo | script\fR), then the session
237 can hang, because the interactive shell within the script session misses EOF and
239 has no clue when to close the session. See the \fBNOTES\fR section for more information.
241 The script command is part of the util-linux package and is available from
242 .UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/