script

make typescript of terminal session 

Command


SYNOPSIS

script [-akq] [-t time] [file] [command ...]


DESCRIPTION

The script utility makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later. If the argument file is given, script saves all dialog in file. If no file name is given, the typescript is saved in the file typescript.

If the argument command is given, script runs the specified command with an optional argument vector instead of an interactive shell.

The script ends when the forked shell (or command) exits. Such exits can include CTRL-Z for the MKS KornShell (sh) or the MKS Bourne-Again Shell (bash) and exit, logout, or CTRL-Z (if ignoreeof is not set) for the MKS C-Shell.

Certain interactive commands, such as vi create garbage in the typescript file. The script utility works best with commands that do not manipulate the screen. The results are meant to emulate a hardcopy terminal, not an addressable one.

Options

-a 

Appends the output to file or typescript retaining their prior contents.

-k 

Logs keys sent to the program as well as output.

-q 

Runs script in quiet mode, omitting the start and stop status messages.

-t time 

Specifies the time interval between flushes of the script output file. A value of 0 causes script> to flush for every character I/O event. The default interval is 30 seconds.


ENVIRONMENT VARIABLES

SHELL 

Specifies, when set, the shell to use when script forks a new shell. When SHELL is not set, script uses the MKS KornShell by default (most shells set this variable automatically).


PORTABILITY

Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022. Windows Server 2025. All UNIX systems.


NOTES

The script utility places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects.

When specifying a command argument on the command line, you also specify the file argument; otherwise, part of the command argument can be misinterpreted as the file argument.

When using the -k option, echo canceling is far from ideal. The slave terminal mode is checked for ECHO mode to see when to avoid manual echo logging. This does not work when in a raw mode where the program being run is doing manual echo.

Only applications which run in the console subsystem may be scripted. Other applications (such as those that run in the Windows subsystems) are killed as soon as script detects that the application is not a console application.

Additionally, applications such as start which cause a child process to launch a new console produce no typescript for the child process.

Finally, because script is implemented using a hidden console window the same size as the visible console window, you should not scroll or resize the visible console window during the script session. Doing so could result in the visible and hidden windows being out of sync and incorrect information being logged in the typescript.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers


SEE ALSO

Commands:
csh, sh


PTC MKS Toolkit 10.5 Documentation Build 40.