Terminal to terminal streaming tips
Marcin Kulik edited this page Jan 7, 2021
·
2 revisions
Great tip from @benaryorg:
A great opportunity to bring up the little known tail idiom: tail -fn +1 file
With that you can effectively output an entire file while still tailing it. That means you can stream without any complicated pipe setup:
# record
asciinema rec file.cast
# play
tail -fn +1 file.cast | asciinema play -
# play via ssh
ssh example.com tail -fn +1 file.cast | asciinema play -
Edit: for lots of output (e.g. coloured stuff like syntax highlighting in shell or editor) I recommend putting a buffer in between to account for network latency and such:
ssh example.com tail -fn +1 file.cast | pv -qB 8m | asciinema play -
Edit2: should be all uppercase -B in the pv invocations
Edit3: and there's the fitting cast: https://asciinema.org/a/163778
Edit4: the ssh-streaming part should also be applicable