Shell – Convert a typescript file to a list of commands (history)

command historyscriptingshelltypescript

I wanted to record a linux session so I could use it as documentation for a "how to install" guide. I found something on the internet that suggested that the script command would be good for this, and so I started it and ran through my installation.

Of course, I didn't read closely enough to realize that the script command actually records keystrokes, so when I go to create my documentation it's full of lines that look like this:

$ make test[K[K[K[Kinstall[1@s[1@u[1@d[1@o[1@

I know that I can use script replay to play the script back, but what I really want to do is run something like scriptreplay but pipe the list of commands that would get executed to a file (I don't want to actually run them).

Is this possible?

I know about the history command, which I probably should have used instead, but I don't have access to the session's history anymore.

Best Answer

For future reference, you could open a shell in emacs with 'M-x shell'. Then the commands you type and the responses are captured in an emacs buffer that you can save to a file.

Related Question