Record your console session

Posted in linux on August 8, 2016 by Adrian Wyssmann ‐ 1 min read

If you ever wanted to record what you are doing on your console, use script. Man page says

make typescript of everything displayed on your terminal

This is very handy, especially to record your interactive session and keep the information for later or even print it out. Simply start your session with

[adrian@archlinux]$ script <filename>
Script started, file is <filename>

Afterwords you can start working with your shell. When you want to end the recording, you simply type

[adrian@archlinux]$ exit
Script done, file is {filename}

Afterwards you can see your activities in the specified {filename}. I usually prefer to define an alias, so I don’t have to worry about the filename and I avoid to overwrite existing session recording

alias script='script ~/Sessions/`date +%Y%m%d%H%M`.txt'
[adrian@archlinux]$ script
Script started, file is /home/user/Sessions/201403081038.txt
[adrian@archlinux]$ exit
exit
Script done, file is /home/user/Sessions/201403081038.txt