Are you typing a complicated set of commands that you need to show someone else or keep "on file" for documentation? Are you debugging a program that goes wrong somewhere - but the error message flashes by so fast that you can't see it? Do you want to show a "pre-recorded" demonstration of an interactive program? The script program can help with all of these problems.
To copy everything you do into a file, just type:
Now you can type any UNIX command that you'd use at a shell prompt.
Everything you do is copied into a file named
(To use a different filename, type its
on the command line, like
The good part is that you can "play back" whatever happened bythe script to your screen. When things get boring, you can run an interactive program like vi inside the script - then quit the script and play it back with cat typescript . The cursor will fly across the screen and your file will be re-edited before your eyes. (This is easier to see if the terminal is set to a slow data rate.)
The bad part is that errors you correct and other terminal-control sequences
will be in the file, too.
If you edit or print the script file, it may be full of "junk" like