Newbie question: how to log a terminal session?

For TX2 debug, I use a pair of terminal commends “script screen.log” and “exit” to save the session. But the saved text is difficult to read due the extra new line mark. In vim, for example, it adds a ^M at the end of each line. Similarly funny character would appear at the line break if you use “gedit”.

Is there a better way to log the terminal session?

That sounds like a windows style end of line is is showing up. I sometimes read such files with “less -r whatever_file_name”…the “-r” reads “raw” control codes and can do things like show intended color in colorized logs.

If you use a serial console then the serial console program can log everything.

For a specific command you might use “tee”, e.g., redirect stderr to stdout and log like this:

someCommand 2>&1 | tee log.txt

For some terminals I just set a massive history size and then mouse copy-and-paste.