recording stdout to a file [Archive] - C Board

PDA

View Full Version : recording stdout to a file


R.Stiltskin
09-28-2003, 10:13 PM
(Not exactly a programming question.)

Working in unix interactively, I remember that there was a command that allowed everything that was being written to the screen to also be saved in a file, but I can't remember the name of the command.

(I don't mean redirecting output of a single command. This was something that, once executed, all subsequent activity on the screen is recorded to a file, until some other key combination ended it.)

What's the mystery command?

R.Stiltskin
09-28-2003, 10:25 PM
hah!

I finally remembered.

If anyone's interested, the command is "script".

Jaguar
09-29-2003, 11:54 AM
What is that command? I am curious.

threahdead
09-29-2003, 12:29 PM
neat program, not too hard to code though.

chrismiceli
09-30-2003, 05:38 AM
i dunno, mabey it has something to do with the stdout redirector,
ls -l > log.log
I don't know how to make it stay on after the program is finished though.

threahdead
09-30-2003, 02:01 PM
when you want to code that program, i suppose its nothing more than opening the STDOUT_FILENO && STDIN_FILENO for reading from it until some special command is received.
all the data read in can be printed to a file.

R.Stiltskin
10-07-2003, 10:35 PM
Sorry, been away for a few days.

Just enter

script [yourfilename]

at the command line.

From that moment on, everything that appears on the terminal screen is also saved to [yourfilename], until you hit control-d to end the script. Now you have a record of everything that appeared on the screen saved to the file that you specified.