script

script command
The script command makes a transcript of the text that is printed to the terminal.  You can record your interaction with the shell using this command.  It will send it to a file that you name or if you do not add a filename it will send it to the default file called "typescript".


-a    append to previous script


Stop the script with CTRL+D or logout of the shell.

script [-a] [-c COMMAND] [-f] [-q] [-t] [file]

Example of script:
Here the command will start and record to a file called "record".  If you want to use this file over and over and keep appending to the contents use the "-a" option.

script record
#######################################################
Script started on Thu 09 Jul 2009 02:35:44 AM MDT

^[[m^[]0;z4@m67: ~/scripts^Gz4@m67:~/scripts$ who^M
z4       tty7         2009-07-09 01:24 (:0)^M
z4       pts/0        2009-07-09 02:07 (:0.0)^M
z4       pts/1        2009-07-09 02:13 (:0.0)^M
^[]0;z4@m67: ~/scripts^Gz4@m67:~/scripts$ last^M
z4       pts/1        :0.0             Thu Jul  9 02:13   still logged in   ^M
z4       pts/0        :0.0             Thu Jul  9 02:07   still logged in   ^M
z4       tty7         :0               Thu Jul  9 01:24   still logged in   ^M
reboot   system boot  2.6.26-2-686     Thu Jul  9 01:24 - 02:35  (01:11)    ^M
z4       pts/0        :0.0             Wed Jul  8 07:50 - 10:17  (02:26)    ^M
---cut---

wtmp begins Wed Jul  1 07:08:38 2009^M
^[]0;z4@m67: ~/scripts^Gz4@m67:~/scripts$ exit^M

Script done on Thu 09 Jul 2009 02:35:59 AM MDT
######################################################


You can see several commands have been used and that there is a "^M" to indicated the end of a line.  The script is ended in the example by using CTRL+D.  Note the start and end times are recorded.

 


Copyright CyberMontana Inc. and BeginLinux.com
All rights reserved. Cannot be reproduced without written permission. Box 1262 Trout Creek, MT 59874