To record terminal data, we use the ttyrec tool. You can also play the recorded data. Now, to record the terminal session, enter the ttyrec command in the terminal. You can end the recording by typing exit. Run the following command to record the terminal session:
$ ttyrec