Dumping terminal contents to a file

2010-09-08 Thread Alois Mahdal

Hi Debian users,

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)

Thanks a lot,
Al.

--
Alois Mahdal ta zxcvb tod cz
...using Opera's revolutionary e-mail client: http://www.opera.com/mail/


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: http://lists.debian.org/op.vip3s3lf53t...@aloism.cz.avg.com



Re: Dumping terminal contents to a file

2010-09-08 Thread Frederik Kriewitz
2010/9/8 Alois Mahdal alois.mah...@zxcvb.cz:
 I wonder if there's  a simple  and universal way  to dump output
 of terminal to a file, particularly for demonstration purposes.

You might be interested in script, it's part of the bsdutils package
which is probably already installed on your system.

DESCRIPTION

 Script makes a typescript of everything printed on your terminal.  It is
 useful for students who need a hardcopy record of an interactive session
 as proof of an assignment, as the typescript file can be printed out
 later with lpr(1).


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/aanlkti=ha2ohxpn8zer2dfhifmmqmgpgawcztvb5s...@mail.gmail.com



Re: Dumping terminal contents to a file

2010-09-08 Thread Stephen Powell
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
 : :'  :
 `. `'`
   `-


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/1733371526.691349.1283967330309.javamail.r...@md01.wow.synacor.com



Re: Dumping terminal contents to a file

2010-09-08 Thread Stephen Powell
On Wed, 08 Sep 2010 13:35:30 -0400 (EDT), Stephen Powell wrote:
 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.
 
 Well, for recording a shell session, there is script.
 And to play it back later, there is scriptreplay.

Something I didn't think about earlier is copy and paste
with gpm.  This works without X.

-- 
  .''`. Stephen Powell
 : :'  :
 `. `'`
   `-


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/1274963982.691539.1283967728311.javamail.r...@md01.wow.synacor.com



Re: Dumping terminal contents to a file

2010-09-08 Thread Alois Mahdal
On Wed, 08 Sep 2010 19:18:23 +0200, Frederik Kriewitz  
frede...@kriewitz.eu wrote:



2010/9/8 Alois Mahdal alois.mah...@zxcvb.cz:

I wonder if there's  a simple  and universal way  to dump output
of terminal to a file, particularly for demonstration purposes.


You might be interested in script, it's part of the bsdutils package
which is probably already installed on your system.




Thanks, that will be very useful--especially for posts to lists like
this one .-D, but still:

 * it saves some way more than I need (all bash's Tab completion
   suggestions, even bells, i haven't checked with colored outputs),
   usually I need just the final plain text

 * what if I did not know that I wanted to dump the output and
   I can't reproduce it again? I'd appreciate possibility to do
   a screenshot, rather

Thanks anyway, you already helped me a lot :D
Al.

--
Alois Mahdal using Opera's revolutionary e-mail client:  
http://www.opera.com/mail/



--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: http://lists.debian.org/op.vip6u4kx53t...@aloism.cz.avg.com



Re: Dumping terminal contents to a file

2010-09-08 Thread manu revah

Le Mer 8 septembre 2010 18:52, Alois Mahdal a écrit :
 Hi Debian users,

 I wonder if there's  a simple  and universal way  to dump output
 of terminal to a file, particularly for demonstration purposes.



not sure if this would do:

 screendump



manu


http://manurevah.com


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/cc5e766cf765a01d19d8d956ca51bb69.squir...@mail.manurevah.com



Re: Dumping terminal contents to a file

2010-09-08 Thread Alois Mahdal

On Wed, 08 Sep 2010 22:28:18 +0200, manu revah m...@manurevah.com wrote:



Le Mer 8 septembre 2010 18:52, Alois Mahdal a écrit :

Hi Debian users,

I wonder if there's  a simple  and universal way  to dump output
of terminal to a file, particularly for demonstration purposes.



not sure if this would do:

 screendump



Yes, Manu! That's exactly what I was looking for!

It seems to be kinda smarter alternative to copying /dev/vcs?, which:
  * ignores garbage characters
  * ignores spaces at the end of line

The fact is that to make it work, you must grant user read rights
for /dev/vcs? and /dev/vcsa?, which potentially might be a security
issue (as user's process might have access to other tty contents),
but for my purpose (testing on VMWares / asking at mailing lists ;D),
it's not really a disadvantage.

Thanks a lot, guys, now I have a nice new set of toys to play with :-D
Al.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/op.viqh58cl53t...@hugo.lennycz-depot



Re: Dumping terminal contents to a file

2010-09-08 Thread Karl Vogel
 On Wed, 08 Sep 2010 12:52:05 -0400 (EDT), Alois Mahdal wrote:

A I wonder if there's a simple and universal way to dump output of
A terminal to a file, particularly for demonstration purposes.

 On Wed, 8 Sep 2010 13:35:30 -0400 (EDT), Stephen Powell
 zlinux...@wowway.com said:

S Well, for recording a shell session, there is script.  And to play it
S back later, there is scriptreplay. [...]  I don't know if that's what
S you want, though.  script puts *everything* in the capture file,
S including linefeeds, backspaces, ANSI escape sequences, etc.  For
S example, colorized output from ls results in ANSI escape sequences.

   I use a wrapper called saveon which tries to correct the worst results
   from script putting everything in the capture file:

  #!/bin/sh
  PATH=/bin:/usr/bin:/usr/local/bin
  SAVEON=1
  export PATH SAVEON
  
  case `whoami` in
  root) prompt='root#' ;;
  *)prompt='me%'   ;;
  esac
  
  export PS1=
  $prompt 
  
  tmp=`mktemp /tmp/$tag.XX` || {
  echo $tag: mktemp failed 2; exit 1
  }
  trap rm -f $tmp; exit 0 0 1 2 3 15
  
  sedscr='
  s/^.*script-is-done://
  s/^.*script-started-on://
  /Script started on /d
  /^me% *$/d
  /^me% exit$/d
  /^root# *$/d
  '
  
  echo script-started-on:`date '+%a %b %d %T %Y'`  $tmp
  script -c /bin/sh -a -q $tmp
  echo script-is-done:`date '+%a %b %d %T %Y'`  $tmp
  col -b  $tmp | sed -e $sedscr  typescript
  exit 0

   * The date commands give me a consistently-formatted start and finish
 time at the top and bottom of typescript.

   * The newline in the prompt cleanly separates commands from output.

   * col -b gets rid of at least some special characters.

   * The SAVEON environment variable lets me set programs to show colors or
 mess with terminal settings only when it makes sense to do so.  For
 example, my dir script looks like this:

  #!/bin/sh
  case $SAVEON in
  ) opt='--color=auto' ;;
  *)  opt='' ;;
  esac
  unset BLOCK_SIZE # throws off the results.
  exec ls -lF $opt ${1+$@}

-- 
Karl Vogel  I don't speak for the USAF or my company

You do not need a parachute to skydive.  You only need a parachute to
skydive twice.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20100909020843.43f0ab...@kev.msw.wpafb.af.mil