Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Shell Scripting
  • Kali Linux
  • Ubuntu
  • Red Hat
  • CentOS
  • Docker in Linux
  • Kubernetes in Linux
  • Linux interview question
  • Python
  • R
  • Java
  • C
  • C++
  • JavaScript
  • DSA
Open In App

scriptreplay command in Linux with Examples

Last Updated : 28 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

scriptreplay command is used to replay a typescript/terminal_activity stored in the log file that was recorded by the script command. With the help of timing information, the log files are played and the outputs are generated in the terminal with the same speed the original script was recorded.

The replay does not run the command again but it only displays the same information once again, thus scriptreplay must be run on the same type of terminal the typescript was recorded to work properly. By default, the replay displays the information stored in a typescript file if no other filename is specified.

Syntax

scriptreplay [-t] timingfile [typescript] [divisor]

where,

  • timingfile: This is the file that contains the timing information captured during the recording.
  • typescript: The terminal session output file that was generated by the script command.
  • divisor: A floating-point number used to speed up or slow down the playback of the recorded session.

How Does It Work?

The script command records terminal sessions and than replay it

Step 1: Record a Session

First, use script to record your terminal activity. For example:

script -t 2>time_log -a geeksforgeeks_session 
  • -t 2>time_log: Saves timing data to time_log.
  • -a geeksforgeeks_session: Saves the terminal output to geeksforgeeks_session.

Step 2: Replay the Session

Play it back with:

scriptreplay -t time_log geeksforgeeks_session  

Basic Example

To replay a recorded script with script filename as geeksforgeeks and timing output file as time_log.

Basic Example

Key Options used with the scriptreplay command

1. -t, --timing:

This option is used for script timing output file.

Example: To replay the script timing file, time_log.

scriptreplay -s geeksforgeeks -t time_log

-t, --timing

2. -s, --typescript:

This option is used for script terminal session output file.

Example: To replay the script namely geeksforgeeks using -s option.

scriptreplay -s geeksforgeeks --timing=time_log

-s, --typescript

3. -d, --divisor:

This option is used when we want to speed up or slow down execution with time divisor. The argument here is a floating point number.

Example 1: To replay the script, geeksforgeeks with 2x speed we will use 2 as a divisor.

Input:

scriptreplay -s geeksforgeeks --timing=time_log 2

The replay speed will increase by twice.

Output:

replay the scriptExample 2: To replay the script, geeksforgeeks with 2 times slower we will use 0.2 as a divisor.

4. -V, --version:

Output version information and exit. -V, --version

5. -h, --help:

Display this help and exit.

  scriptreplay --help

-h, --help

Conclusion

The scriptreplay command is a valuable tool for anyone who needs to recreate terminal sessions exactly as they occurred. scriptreplay ensures that you can accurately replay and analyze terminal behavior by using options like timing adjustments and divisors, having full control over how the playback is displayed, making it adaptable to various scenarios.


S

suraj1994
Improve
Article Tags :
  • Linux-Unix
  • linux-command
  • Linux-misc-commands

Similar Reads

    rev command in Linux with Examples
    rev command in Linux is used to reverse the lines characterwise. This utility reverses the order of the characters in each line by copying the specified files to the standard output. If no files are specified, then the standard input will be read. Here, we will explore the syntax, examples, and opti
    3 min read
    rm command in Linux with examples
    rm stands for remove here. rm command is used to remove objects such as files, directories, symbolic links and so on from the file system like UNIX. To be more precise, rm removes references to objects from the filesystem, where those objects might have had multiple references (for example, a file w
    5 min read
    rmdir Command in Linux With Examples
    In Linux, managing directories efficiently is a crucial skill for both system administrators and everyday users. The 'rmdir' command is a specialized tool designed specifically for removing empty directories, helping to maintain a clean file system and avoid accidental data loss. This guide delves i
    6 min read
    rmmod command in Linux with Examples
    The rmmod command in Linux is used to remove or unload a module from the kernel. Modules are pieces of code that can be dynamically loaded into the Linux kernel to extend its functionality, such as drivers for hardware devices. When a module is no longer needed, it can be removed using rmmod. Althou
    3 min read
    How to check the routing table in Linux | route Command
    The IP/kernel routing table acts as a crucial map, determining how network packets are forwarded between different hosts and networks. By utilizing the route command, Linux administrators and users can establish static routes, enabling precise control over network connectivity and optimizing data tr
    4 min read
    rsync command in Linux with Examples
    rsync or remote synchronization is a software utility for Unix-Like systems that efficiently sync files and directories between two hosts or machines. One is the source or the local-host from which the files will be synced, the other is the remote-host, on which synchronization will take place. Ther
    7 min read
    SAR command in Linux to monitor system performance
    sar (System Activity Report) It can be used to monitor Linux system's resources like CPU usage, Memory utilization, I/O devices consumption, Network monitoring, Disk usage, process and thread allocation, battery performance, Plug and play devices, Processor performance, file system and more. Linux s
    9 min read
    How to Securely Copy Files in Linux | scp Command
    Secure file transfer is a crucial part of Linux systems administration. Whether moving sensitive files between local machines or transferring data between servers, or you need to move backup files to a remote server, fetch logs from a hosted machine, or sync directories across multiple systems, scp
    10 min read
    screen command in Linux with Examples
    The screen command is an advanced terminal multiplexer that allows you to have multiple sessions within one terminal window. It's like having "tabs" in your Linux terminal — you can open, detach, switch, or resume sessions at any time without losing what you're working on. It's particularly convenie
    7 min read
    script command in Linux with Examples
    The 'script' command in Linux is a versatile tool that allows you to record all terminal activities, including inputs and outputs, making it a valuable resource for developers, system administrators, educators, and anyone who needs to document terminal sessions. This command captures everything disp
    5 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences