1SCRIPT(1)                        User Commands                       SCRIPT(1)
2
3
4

NAME

6       script - make typescript of terminal session
7

SYNOPSIS

9       script [options] [file]
10

DESCRIPTION

12       script makes a typescript of everything displayed 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 the dialogue in this  file.
18       If no filename is given, the dialogue is saved in the file typescript.
19

OPTIONS

21       Below, the size argument may be followed by the multiplicative suffixes
22       KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB,  PiB,  EiB,  ZiB
23       and YiB (the "iB" is optional, e.g. "K" has the same meaning as "KiB"),
24       or the suffixes KB (=1000), MB (=1000*1000), and so on for GB, TB,  PB,
25       EB, ZB and YB.
26
27       -a, --append
28              Append  the output to file or to typescript, retaining the prior
29              contents.
30
31       -c, --command command
32              Run the command rather than an interactive shell.  This makes it
33              easy  for  a  script  to  capture  the  output of a program that
34              behaves differently when its stdout is not a tty.
35
36       -e, --return
37              Return the exit code of the child process.  Uses the same format
38              as  bash  termination  on signal termination exit code is 128+n.
39              The exit code of the child process  is  always  stored  in  type
40              script file too.
41
42       -f, --flush
43              Flush  output  after  each write.  This is nice for telecoopera‐
44              tion: one person does `mkfifo foo; script -f foo',  and  another
45              can supervise real-time what is being done using `cat foo'.
46
47       --force
48              Allow  the default output destination, i.e. the typescript file,
49              to be a hard or symbolic link.  The command will follow  a  sym‐
50              bolic link.
51
52       -o, --output-limit size
53              Limit  the  size  of the typescript and timing files to size and
54              stop the child process after this size is exceeded.  The  calcu‐
55              lated  file  size  does  not include the start and done messages
56              that the script  command  prepends  and  appends  to  the  child
57              process  output.   Due  to  buffering, the resulting output file
58              might be larger than the specified value.
59
60       -q, --quiet
61              Be quiet (do not write start and done messages to standard  out‐
62              put).
63
64       -t[file], --timing[=file]
65              Output  timing  data  to  standard error, or to file when given.
66              This data contains two fields, separated by a space.  The  first
67              field indicates how much time elapsed since the previous output.
68              The second field indicates how many characters were output  this
69              time.   This  information can be used to replay typescripts with
70              realistic typing and output delays.
71
72       -V, --version
73              Display version information and exit.
74
75       -h, --help
76              Display help text and exit.
77

NOTES

79       The script ends when the forked shell exits (a control-D for the Bourne
80       shell  (sh(1)), and exit, logout or control-d (if ignoreeof is not set)
81       for the C-shell, csh(1)).
82
83       Certain interactive commands, such as  vi(1),  create  garbage  in  the
84       typescript  file.   script works best with commands that do not manipu‐
85       late the screen, the results are meant to emulate a hardcopy terminal.
86
87       It is not recommended to run script  in  non-interactive  shells.   The
88       inner  shell  of  script  is always interactive, and this could lead to
89       unexpected results.  If you use  script  in  the  shell  initialization
90       file,  you  have  to  avoid entering an infinite loop.  You can use for
91       example the .profile file, which is read by login shells only:
92
93              if test -t 0 ; then
94                  script
95                  exit
96              fi
97
98       You should also avoid use of script in command  pipes,  as  script  can
99       read more input than you would expect.
100

ENVIRONMENT

102       The following environment variable is utilized by script:
103
104       SHELL  If the variable SHELL exists, the shell forked by script will be
105              that shell.  If SHELL is not set, the Bourne shell  is  assumed.
106              (Most shells set this variable automatically).
107

SEE ALSO

109       csh(1) (for the history mechanism), scriptreplay(1)
110

HISTORY

112       The script command appeared in 3.0BSD.
113

BUGS

115       script  places  everything  in  the  log  file, including linefeeds and
116       backspaces.  This is not what the naive user expects.
117
118       script is primarily designed for interactive terminal  sessions.   When
119       stdin is not a terminal (for example: echo foo | script), then the ses‐
120       sion can hang, because the interactive shell within the script  session
121       misses  EOF  and script has no clue when to close the session.  See the
122       NOTES section for more information.
123

AVAILABILITY

125       The script command is part of the util-linux package and  is  available
126       from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
127       linux/⟩.
128
129
130
131util-linux                         June 2014                         SCRIPT(1)
Impressum