Q. How do I make typescript of terminal session for training purpose or just to monitor other user terminal under Linux?

A. Use script command. It makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment or use this tool to demonstrate some concepts.

Login as student and type the following two commands:
$ mkfifo hardcopy
$ script hardcopy

Login as instructor and type the following command to view typescript of terminal session for student user:
$ cat /home/student/hardcopy

Now anything typed by user student, including all commands and other sessions, will be displayed to the instructor user screen. Use this trick to demonstrate Linux configurations and command usage to student or just to monitor their activity in a classroom.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 8 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
8 comments… add one
  • xiao_haozi Jan 10, 2008 @ 16:18

    You could also use screen. Start a screen session with a socket name by using “screen -S student” then everyone can attach the screen with “screen -x student” and everyone with it attached can utilize the session. Then “screen -list” with help if you forget which sessions are detached.

  • 🐧 nixCraft Jan 10, 2008 @ 16:29


    Excellent idea.

    Appreciate your post.

  • xiao_haozi Jan 11, 2008 @ 19:07

    No problem. What I like about using screen in this way is that it is interactive. In essence both parties can actively type on the command line. So for example, if student types the command:
    ls -alh \ , I can simply delete the \ before they hit enter and replace it with /, for example.

  • atul_iims Jan 17, 2008 @ 6:09

    i have one query that is i am having one text file which include lots of version like


    my problem is how to extract string one place like
    Compress-Zlib & version in other file 2.001.tar.gz
    please if you have any idea about this please mail me atul_iims@yahoo.com

  • Asim Jan 1, 2009 @ 18:50

    I’ve tried it but it does not working… please explain a little bit…

  • aaaa Apr 6, 2009 @ 18:46

    yes, script just takes over the input.

  • argv Jul 28, 2009 @ 4:51

    I wish that all installations of screen were replaced or supplemented with tmux. I’ll bet that if you try tmux and stick with it for as long as you did with screen, you would find it far it to be a superior substitute. The biggest disadvantage of tmux is that it’s not well known and hence likely not to be in a standard *NIX installation.
    If you are a command line purist who likes screen, tmux is a must try.
    Screen good. Tmux better.
    My opinion pnly, of course.

  • gag0q May 30, 2012 @ 8:18

    Hmm cooll !

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum