I am trying to get help from someone, so I want to record my screen to be able to later review what happened. Formerly, I have used ssh
with tee
like ssh user@server | tee recfile
and the recording works fine. Even when I use byobu
on the server, everything is recorded using that simple pipe.
But when I pipe byobu
itself to tee, the file will contain pretty nothing. I have used both byobu | tee recfile
and byobu |& tee recfile
. In both cases, byobu
starts and works well, but the record file will only contain a few lines not related to the things happened in byobu session.
And byobu
uses tmux
. I have tried to pipe tmux
to tee
as well, and the output file only contained [exited]
.
My question is how tmux
writes to the screen? It seems that it does not use standard output or standard error, as if it did, tee
could work recording the screen. Is there a way to tell tmux
to write to the standard output or standard error? Or is there another way to redirect the output to tee
?
Edit: I checked that screen | tee recfile
and screen |& tee recfile
will produce an empty file. Also, bash | tee recfile
will only redirect the output of executed commands to the file (user@name:~$
's and the input commands are not in there). bash |& tee recfile
will do likewise, except that the prompt of the bash (user@name:~$
) is not displayed at all.
As gniourf_gniourf pointed out, script
solved my problem.
I also wrote a simple C++ code to playback the recorded file. Compile it with --std=c++11
. (I use script -c byobu --timing=recfile.tim recfile
to record and scriptout recfile recfile.tim 3
for playback.)
https://gist.github.com/Shayan-To/672c77fbf9811d769d453c8a9b43747e