How can I capture text from a specific terminal and redirect it to a log file while simultaneously working? [duplicate]
The script command can do this, it starts a session and all output is by default captured into a file called typescript. Alternatively, one can specify the filename to contain the captured session, e.g.
script capture.txt
..then run your commands and finally type "exit" to exit the session.
To ensure you don't get any control characters, use:
TERM=dump
script capture.txt
and when you exit, use:
col -b < capture.txt > cleaned-capture.txt