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       -a, --append
22              Append  the output to file or to 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 (do not write start and done messages to standard out‐
46              put).
47
48       -t[file], --timing[=file]
49              Output timing data to standard error, or  to  file  when  given.
50              This  data contains two fields, separated by a space.  The first
51              field indicates how much time elapsed since the previous output.
52              The  second field indicates how many characters were output this
53              time.  This information can be used to replay  typescripts  with
54              realistic typing and output delays.
55
56       -V, --version
57              Display version information and exit.
58
59       -h, --help
60              Display help text and exit.
61

NOTES

63       The script ends when the forked shell exits (a control-D for the Bourne
64       shell (sh(1)), and exit, logout or control-d (if ignoreeof is not  set)
65       for the C-shell, csh(1)).
66
67       Certain  interactive  commands,  such  as  vi(1), create garbage in the
68       typescript file.  script works best with commands that do  not  manipu‐
69       late the screen, the results are meant to emulate a hardcopy terminal.
70
71       It  is  not  recommended  to run script in non-interactive shells.  The
72       inner shell of script is always interactive, and  this  could  lead  to
73       unexpected  results.   If  you  use  script in the shell initialization
74       file, you have to avoid entering an infinite loop.   You  can  use  for
75       example the .profile file, which is read by login shells only:
76
77              if test -t 0 ; then
78                  script
79                  exit
80              fi
81
82       You  should  also  avoid  use of script in command pipes, as script can
83       read more input than you would expect.
84

ENVIRONMENT

86       The following environment variable is utilized by script:
87
88       SHELL  If the variable SHELL exists, the shell forked by script will be
89              that  shell.   If SHELL is not set, the Bourne shell is assumed.
90              (Most shells set this variable automatically).
91

SEE ALSO

93       csh(1) (for the history mechanism), scriptreplay(1)
94

HISTORY

96       The script command appeared in 3.0BSD.
97

BUGS

99       script places everything in  the  log  file,  including  linefeeds  and
100       backspaces.  This is not what the naive user expects.
101
102       script  is  primarily designed for interactive terminal sessions.  When
103       stdin is not a terminal (for example: echo foo | script), then the ses‐
104       sion  can hang, because the interactive shell within the script session
105       misses EOF and script has no clue when to close the session.   See  the
106       NOTES section for more information.
107

AVAILABILITY

109       The  script  command is part of the util-linux package and is available
110       from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
111       linux/⟩.
112
113
114
115util-linux                         June 2014                         SCRIPT(1)
Impressum