You can use asciicinema to record your terminal session. For example, you may want to demo some commands to someone.
Installing the tool:
sudo apt install asciinema
Start recording with the command below:
asciinema rec demo.cast
asciinema: recording asciicast to demo.cast
asciinema: press <ctrl-d> or type "exit" when you're done
Type ctrl + d to terminate the recording:
asciinema: recording finished
asciinema: asciicast saved to demo.cast