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

by Vivek Gite on January 10, 2008 · 7 comments

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.

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 7 comments… read them below or add one }

1 xiao_haozi January 10, 2008

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.

Reply

2 vivek January 10, 2008

xiao_haozi,

Excellent idea.

Appreciate your post.

Reply

3 xiao_haozi January 11, 2008

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.

Reply

4 atul_iims January 17, 2008

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

Reply

5 Asim January 1, 2009

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

Reply

6 aaaa April 6, 2009

yes, script just takes over the input.

Reply

7 argv July 28, 2009

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.

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 5 + 3 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the simple math so we know that you are a human and not a script.




Previous post:

Next post: