How can I record my Linux terminal session in text mode and share or replay it later?
I want to record my Amazon Elastic Compute Cloud (Amazon EC2) Linux terminal session or SSH session in text mode and then share it or replay it later. How can I do this?
"I want to record my Amazon Elastic Compute Cloud (Amazon EC2) Linux terminal session or SSH session in text mode and then share it or replay it later. How can I do this?Short descriptionYou can record your SSH or terminal session to a file using the script command. If you need help, you can run the man script command to access the user manual.ResolutionRecord the session1.    Open an SSH terminal. Replace the example IP address in the following command with your IP address or hostname.$ ssh 198.51.100.02.    Start a script session. In the following command, -a enables append mode and -t sets a timing file.$ script -a -t timingfile.txt typescript.txt3.    Run any commands that you want to record. The commands and any output are recorded.4.    When done, exit the script session by typing exit or pressing Ctrl-D.5.    Files named typescript.txt and timingfile.txt contain the recorded data. You can share these files as needed.Replay the session1.    Copy the typescript.txt and timingfile.txt files to a Linux (or Unix) server or replay them from the same server.2.    Use the following command to show the complete output of the typescript.txt file immediately without a delay:$ cat typescript.txt3.    Use the following command to replay the file with normal timing:$ scriptreplay --timing=timingfile.txt typescript.txt4.    Use the following command to replay the file with a timing divisor to enable faster replay:$ scriptreplay --timing=timingfile.txt typescript.txt -d 10Note: The Linux executables script and scriptreplay come pre-installed by default, so they don't need to be installed separately. If you do need to install them, use the following command that corresponds to your operating system:Ubuntu 16 and Ubuntu 18:sudo apt install bsdutilsRHEL 6:sudo yum install util-linux-ngRHEL 7, Amazon Linux 1, and Amazon Linux 2:sudo yum install util-linuxRelated informationHow to record SSH sessions established through a bastion hostFollow"