script—creates a typescript of a terminal session

script [ –a ] [ filename ]

script makes a typescript of everything printed on your terminal. The typescript is written to a filename. If no filename is given, the typescript is saved in the file called typescript. The script ends when the shell exits or when Ctrl-D is typed.

Example A.50.
1  script
2  script myfile

Explanation

  1. Starts up a script session in a new shell. Everything displayed on the terminal is stored in a file called typescript. Must press ^d or exit to end the session.

  2. Starts up a script session in a new shell, storing everything displayed on the terminal in myfile. Must press ^d or exit to end the session.

Get Linux Shells by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.