How to: Snoop / View Other Linux Shell User Typescript of Terminal Session

by Vivek Gite [Last updated: January 10, 2008]

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.

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 5 comments… read them below or add one }

1 xiao_haozi 01.10.08 at 4:18 pm

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.

2 vivek 01.10.08 at 4:29 pm

xiao_haozi,

Excellent idea.

Appreciate your post.

3 xiao_haozi 01.11.08 at 7:07 pm

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.

4 atul_iims 01.17.08 at 6:09 am

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

likeCompress-Raw-Zlib-2.001.tar.gz
Compress-Zlib-2.001.tar.gz
ConsoleKit-0.2.3.tar.gz
Convert-ASN1-0.20.tar.gz
Crypt-SSLeay-0.51.tar.gz

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

5 Asim 01.01.09 at 6:50 pm

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

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tagged as: , , , , , ,

Previous post: Linux Set the Block Size for a SCSI Tape Device

Next post: Stop Ubuntu / Debian Linux From Deleting /tmp Files on Boot