Examples:
$ ls -la > /var/tmp/output.ls.txt $ ls -la | tee /var/tmp/output.ls.txt
But sometimes programs can be interactive or we simply want to capture all our session without to worry to redirect the stdout to a file.
The solution is to use the 'screen' tool.
Example #1: Screen basic usage
# to start the session with a name 'example' run $screen -h $screen -S example # to leave the screen session type: CONTROL-a d # you are placed back in the original shell # to reattach to the created session $ screen -ls $ screen -r example
Example #1: Enable screen logging
The options '-L' instruct screen to create a log file that will capture all the commands output in the screen session.
$ screen -S logexample -L # inside the screen session $ echo 'some output' # to leave the screen session type: CONTROL-a d # this is the default log file for screen $ ls -la screenlog.0 $ cat screenlog.0
No comments:
Post a Comment