The script command

The script command



What does it do ?

It saves in a text file (called typescript) everything that appears on the screen.


How is it used ?

By typing script at the UNIX prompt.

To exit script press CTRL D


Examples and remarks

This example shows you how to get a printout of your directory's files, but script can be used for much more. For instance, one common use is to obtain a printout of a program's inputs and outputs.

Warning: Everything that appears on your screen will go into a file called typescript. If you have a previous file called typescript the new file will replace the existing one.

Type script at the UNIX prompt. (UNIX will reply that you have started a script session.)

Type ls (shows you a list of your files.)

Press CTRL D (exits you from script. "You must exit from script in order to get a printout.")

Type pr typescript (prints typescript file.)



next previous table of contents