asciinema (source) records terminal sessions as small text files (.cast) that replay in a terminal or web page, with text that can be selected and copied.
sudo dnf install asciinema # or apt-get install asciinema, or: pip install asciinema
asciinema rec demo.cast # start recording; run your commands; Ctrl+D or `exit` to stop
asciinema play demo.cast # replay locally
asciinema rec -c 'ansible-playbook site.yml' run.cast # record a single command
asciinema rec --idle-time-limit 2 demo.cast # cap long pauses
asciinema upload demo.cast # publish to asciinema.org (or a self-hosted server)
If you omit the file name, the cast is saved to a temporary path under /tmp and printed when you finish. Give it a name to keep it. Recordings capture everything shown on screen, so avoid displaying secrets while recording. Alternative built into util-linux: script/scriptreplay.