1

I'm looking for a way to log all the input and output on terminal during a session, but I can't properly find an answer to do it. This this post suggested using script screen.log to do so and it seems perfect, that's EXACTLY what I needed. However, this generate a file with very weird characters as shown in this picture (screenshot from VIM of the file). I have also tried to open it with Sublime Text and the weird characters are there as well.

I have tried this method on two different machines, one using WLS 2 with Ubuntu 20.04.1 LTS (focal) and the other using WLS 1 with Ubuntu 18.04.2 LTS (bionic). Both had the same result.

Is there any way to do exactly this without the weird characters?

Many thanks

Jn Coe
  • 11

1 Answers1

0

As pointed out by Steeldriver, those are control sequences. After doing some google with this term I was able to find this post with a solution: Just run the script command as usual After saving the file, remove the junk characters with this command:

cat typescript | perl -pe 's/\e([^\[\]]|\[.*?[a-zA-Z]|\].*?\a)//g' \
             | col -b > typescript-processed

Worked for me

Jn Coe
  • 11