How to Record and Replay Linux Terminal Sessions using ‘script’ and ‘scriptreplay’ Commands

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

30 Responses

  1. Dipak Phadatare says:


    How to call function in script command and record the terminal output in log file?

  2. sahil says:

    Hi Aaron,

    I’m unable to direct the timing information in a file.

    script --timing=filename.txt script.log
    script: invalid option — ‘-‘
    usage: script [-a] [-f] [-q] [-t] [file]

    Could you please help out.

  3. sahil says:

    Hi Aaron,

    I’m unable to get the time information directed to the time file.

    [ ~]#script –timing=filename.txt script.log
    script: invalid option — ‘-‘
    usage: script [-a] [-f] [-q] [-t] [file]
    #script –version
    script (util-linux-ng 2.17.2)

    Could you please help me out. I’m using centOS 6.

  4. SV says:

    Getting this error, any idea? It dies immediately.

    $ script
    Script started, file is typescript
    wsh: invalid option — ‘i’
    error=3 Invalid parameter
    usage: wsh [-d][ -c ][ -p ][ -s ]
    Sets login environment and spawns an interactive server.
    -d enable debugging
    -c set a single executed command
    -p set the configuration full path
    -s set the shell full path
    Script done, file is typescript

  5. Palani K says:

    How we can remove junk characters in ouput, No clear information in output.

  6. Keydon says:

    Are there specialized services or tools which convert those log and timing file to a gift similar to yours?

  7. foo bar says:

    how to install those commands on ubuntu ? -_-

  8. Dan Stromberg says:

    I wrote pypty, which is a pure-python reimplementation of script(1). It includes script-replay (note the dash), which allows you to step through your scripts with arrow keys (curses) or buttons (GObject Introspection).

  9. kunalsing says:

    When We are using –timing=time.txt It does not working It Does not show No such file or directory

    • Aaron Kili K says:

      @kunalsing You need to use the – -timing=filename.txt option with script first to create the timing information file, you can use any other name apart from time.txt, then use
      – -timing option with scriptreplay ie – -timing=filename.txt . The filename used with script must be the same as the one used with scriptreplay.

  10. Leon van Kammen says:

    I find these kind of tools very useful for tutorial purposes.
    Next to script there’s also ttyrec (available thru package manager on almost any distro).

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.