Skip to content

Command script on Linux (recording commands)

The script and scriptreplay tools can be used to create a script of all the commands entered in the shell, so that they can be printed, or played as if it were one” replay” in the shell itself, maintaining its order and chronology.

To create a shell session script, you can use the script command:

$ script arquivo.log

Everything that is typed and printed on the screen will be recorded in the arquivo.log file, until the “exit” command is executed.

The arquivo.log will have the typescript format that can be printed.

But these tools look incredible with the “—timing” option, which creates a time file, making it possible to “play” the script like a replay:

``` $ script —timing=time.txt arquivo.log

After typing all the commands and exiting the **script** with "**exit** “, it is possible to play what was recorded with **scriptreplay**.
In this way, the **scriptreplay** command can be used to show everything that was typed on the screen, at the same speed, as if it were a “movie”:

$ scriptreplay -t time.txt script.log

![](https://www.certificacaolinux.com.br/wp-content/uploads/2021/12/ooure86.jpeg)These two commands can be extremely useful for documenting a software installation process, correcting a problem, for training purposes, etc.
Learn much more about Linux in our online course. You can register here. If you already have an account, or want to create one, just log in or create your user here.
Did you like it?
-----------------
Share