Skip to main content

How to Record a Linux Terminal (TTY) Session

A step-by-step guide on how to record a Linux terminal (tty) session

Scott avatar
Written by Scott
Updated over 3 weeks ago

In this article we are discussing about how to generate a recorder for Linux command line practice. It will be useful to save your command line activities which you have done, for your future reference. We know 'history' command also do the same, but the difference is, we can see the o of the commands too.


We use the command 'script'. The usage of this command is very simple. The working of this command is, we can save our activities to a test file which can be easily accessible from the command line itself.

Syntax

script <output_file_path>

  1. Run the following command on the server to begin logging your SSH session activity.

    # script /tmp/record.txt 

    From now onwards, your current shell will be recorded to the output file /tmp/record.txt

  2. You can now execute the commands within your SSH session, and all activities will be recorded in the specified file. For example:

    #hostname
    #cat /proc/loadavg
    #date

  3. To exit and stop logging your SSH terminal commands, simply type exit or press Ctrl + D. The output of this command will also be saved in the log file.

  4. Run the following command to view the data recorded during your session.

     # cat /tmp/record.txt 



    Congratulations! You’ve successfully recorded your Linux terminal session.

    If you have any questions, please don’t hesitate to contact our team via live chat.

    For technical inquiries, please feel free to reach our support team by emailing support@bigscoots.com from your registered email or by submitting a support ticket.

Did this answer your question?