Some terminal magic -scriptreplay
Posted: 22 Sep 2015, 00:45
![]() |
When using Linux the terminal comes in handy but often I forget all that brilliant stuff that I did ..about five minutes after I am finished...
Inspiration and memory comes and goes...
So imagine you could "tape" everything you did in that terminal for the last hour - with the ability to play it back!
Wouldn't that be nice? No more terminal alzheimer and you can document eggzactly what you did.
Well in fact you are not replaying what you did as a movie, you are performing all those commands one more time. Every command from the last hour are now executing in your terminal.
..Like magic...
The script command lets you log everything you do to a log file.
You start the session like this
Code: Select all
script berserk.logThen you can perform an inxi -Fz and a whoami and a w and a ls
this will all be logded until you type
Code: Select all
exitIf you are a tech and need to keep your back free regarding that work on the clients computer you can simply download that file to your dongle.
But that is just a boring log.
Moving on to the next computer you need to do eggzactly the same procedure you say?Well this is where the magic comes in.
To make the log "replayable" we need to make that script command a little bit more complicated.
Code: Select all
script --timing=file.tm berserk.logThere is a need to add a timing file to make the replay work - there is no need to understand it; just call the file file.tm - like I have done above - and be done with it.

berserk.log is the name I have chosen to give my log file - you may choose something else.
Now you can start your session and type
Code: Select all
exitTo repeat all commands from that session ...like magic:
Code: Select all
scriptreplay -t file.tm berserk.logHit enter.. and lean back and watch your terminal work
scriptreplay is mega cool

More here
Check this out



