logging a output(regular or error) of a unix program into a file.
+3
A:
start it with
./program > file.log 2>&1this will redirect stdout and stderr to file.log
matei
2010-04-23 16:29:26
A:
Redirection like the above answer is very standard, but sometimes you really want to capture everything in a session. For that you can use the 'script' command.
$ script /path/to/output_file [starts a subshell] $ ./program $ exit $ cat /path/to/output_file
The advantage of script is you don't need to worry about shell semantics and knowing which shell you're running etc.. The disadvantage is that it really does capture everything that makes it to your terminal, including control codes, delete keys, etc...
Alan Horn
2010-05-04 09:41:43