Linux and Unix script command

Quick links

About script
Syntax
Examples
Linux and Unix main page

About script

Records everything printed on your screen. The record is recorded to the filename, if no filename is specified results are recorded to the file transcript.

Syntax

script [-a]  filename

-aAppend the session record to filename, rather than overwrite it.
filenameThe name of the file that you wish the results to be stored.

Examples

script myfile.txt

Will log all results into the file myfile.txt. This will open a sub-shell and records all information through this session. The script ends when the forked shell exits (user types exit) or when CTRL-D is typed.

Note: If the script file is deleted during the script process the script still remains in memory however will not log the results.