Recording input and output of terminal session

script  makes  a typescript of everything displayed on your terminal...

Start a “script” session

script test.txt

Type some commandos and then CTRL-D or exit when you are done. Then view the result using cat.

root@DESKTOP-E0LB7EC:~# cat test.txt
Script started on Fri 08 Jun 2018 03:56:00 PM DST
root@DESKTOP-E0LB7EC:~# ls
test.txt
root@DESKTOP-E0LB7EC:~# touch a
root@DESKTOP-E0LB7EC:~# echo "hei" > a
root@DESKTOP-E0LB7EC:~# cat a
hei
root@DESKTOP-E0LB7EC:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          223G  110G  113G  50% /
none            223G  110G  113G  50% /dev
none            223G  110G  113G  50% /run
none            223G  110G  113G  50% /run/lock
none            223G  110G  113G  50% /run/shm
none            223G  110G  113G  50% /run/user
C:              223G  110G  113G  50% /mnt/c
root@DESKTOP-E0LB7EC:~# exit
exit

Script done on Fri 08 Jun 2018 03:56:47 PM DST

-q option can be used to avoid info about starting and stopping script

Alternatives - Asciinema

There is another program Asciinema which is not a built in program, result of a screencast: