logging with script

While you can log everything with screen’s logging functionality, or tee it to some file, you can also use script.

Script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an inter‐active session as proof of an assignment, as the typescript file can be printed out later with lpr(1).

% script foo
Script started, file is foo
% ps
  PID TTY          TIME CMD
11448 pts/3    00:00:00 zsh
11511 pts/3    00:00:00 ps
%
Script done, file is foo
 
% cat foo
Script started on Fri Jun 18 10:13:14 2010
% ps
  PID TTY          TIME CMD
11448 pts/3    00:00:00 zsh
11511 pts/3    00:00:00 ps
% <ctrl +d>
Script done on Fri Jun 18 10:13:25 2010                            
</ctrl>

Leave a Reply