Re: Dumping terminal contents to a file
On Wed, 08 Sep 2010 12:52:05 -0400 (EDT), Alois Mahdal wrote:
>
> I wonder if there's a simple and universal way to dump output
> of terminal to a file, particularly for demonstration purposes.
>
> Most of the time when I need to do that, I either use X (or
> PuTTY, when on Windows) facilities, but often it's not possible,
> or it may become awkward (due to need to switch between mouse
> and keyboard).
>
> I know there are things like 'screen', but I'm looking for
> the most universal solution that would work on every system.
>
> For example, on SUSE, I can:
>
> cat /dev/vcs > example.txt
>
> (...though it's catted as a single line with *all* spaces up
> to $COLS (meaning, e.g. that each--even empty--line would appear
> as $COLS 0x020-spaces), so it needs some post-processing.)
>
> ...but that didn't work on Debian/Lenny for me.
>
> Any suggestions?
>
> (Extra bonus points for linux-osx-freebsd-unicode-compatible
> version. :-D)
Well, for recording a shell session, there is "script".
And to play it back later, there is "scriptreplay".
Both tools are from package bsdutils, which is a required
package and is marked essential in Debian.
I don't know if that's what you want, though. script puts
*everything* in the capture file, including linefeeds,
backspaces, ANSI escape sequences, etc. For example,
colorized output from "ls" results in ANSI escape sequences.
Commands which produce full-screen output, such as ncurses-based
applications, vi, etc. result in lots of "garbage" output.
It works best when running commands which produce pure line-mode
output.
--
.''`. Stephen Powell
: :' :
`. `'`
`-
Reply to: