ed9a Using script(1) to capture console output - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Miscellaneous > Howtos & FAQs

Howtos & FAQs Would you like to share some of your solutions for certain problems? Tips or tricks? Post here.

Reply
 
Thread Tools Display Modes
  #1  
Old August 27th, 2010, 19:09
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,701
Thanks: 429
Thanked 1,757 Times in 1,456 Posts
Default Using script(1) to capture console output

script(1) can be used to capture console session output. This is useful for later reference, like looking for what caused a port to fail to build.

Example:
Code:
# script /tmp/session.txt
# cd /usr/ports/www/links
# make
...
# exit

Script done, output file is /tmp/session.txt
Everything that was shown on the screen is captured in the output file /tmp/session.txt.
Reply With Quote
The Following 5 Users Say Thank You to wblock@ For This Useful Post:
benpptung (November 9th, 2010), Caliante (October 10th, 2010), Nat_RH (May 23rd, 2011), sistematico (June 19th, 2012), UNIXgod (August 30th, 2010)
  #2  
Old October 10th, 2010, 17:29
Caliante Caliante is offline
Junior Member
 
Join Date: Jan 2009
Posts: 96
Thanks: 90
Thanked 2 Times in 2 Posts
Default

Excellent, this helped me already

Thank you
Reply With Quote
  #3  
Old October 11th, 2010, 00:57
jb_fvwm2 jb_fvwm2 is offline
Senior Member
 
Join Date: Nov 2008
Posts: 1,385
Thanks: 60
Thanked 145 Times in 130 Posts
Default

One can also use tee or sysutils/Tee similarly
Code:
man tee && man Tee
if the latter installed. A third exists but is in sysutils/moreutils and I am unsure of how it is precisely useful in this case (The first post).

Last edited by DutchDaemon; October 11th, 2010 at 02:01. Reason: stop hitting [enter] ..
Reply With Quote
The Following User Says Thank You to jb_fvwm2 For This Useful Post:
Caliante (October 11th, 2010)
  #4  
Old November 4th, 2010, 00:25
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,701
Thanks: 429
Thanked 1,757 Times in 1,456 Posts
Default

Quote:
Originally Posted by jb_fvwm2 View Post
One can also use tee or sysutils/Tee similarly
Code:
man tee && man Tee
if the latter installed. A third exists but is in sysutils/moreutils and I am unsure of how it is precisely useful in this case (The first post).
One difference between script(1) and tee(1) is that script captures everything, stdin, stderr, even the control characters typed or output. tee(1) only captures stdin, not everything. Of course, you can redirect, but script(1) is already there. And it's in the base system.
Reply With Quote
  #5  
Old November 13th, 2010, 22:14
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Member
 
Join Date: Nov 2008
Location: Eindhoven, Netherlands
Posts: 794
Thanks: 19
Thanked 123 Times in 93 Posts
Default

As a minor note, the rprompt option in tcsh screws up any output from script(1), so be sure to disable this.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #6  
Old November 17th, 2010, 02:28
eye's Avatar
eye eye is offline
Junior Member
 
Join Date: Nov 2010
Posts: 41
Thanks: 1
Thanked 9 Times in 9 Posts
Default

Nah, only for those who view typescript files as plain text in dumb terminals. less(1) have -r and -R options to render terminal control sequences.

One can also record session with timestamps using -r option (cf. script(1) on NetBSD). It can later be played using -p option, e.g. to observe how user interacted with ncurses application such (nvi(1), tcsh(1)'s tab-completion, etc.). A few years back there were plenty of recorded howtos on youterm.com, mostly for radare, that could be viewed either via telnet or java applet. The feature is ported to FreeBSD in bin/114465.

Last edited by eye; December 20th, 2010 at 08:58. Reason: mentioned affected PR
Reply With Quote
The Following User Says Thank You to eye For This Useful Post:
Carpetsmoker (November 17th, 2010)
Reply

Tags
capture, console, error, log, script

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Screen video capture/grabbing smooky Multimedia 7 May 11th, 2010 11:59
Problems booting nanobsd image - no output to serial console mix_room Installing & Upgrading 2 April 18th, 2010 17:45
problems booting freebsd installation on net5501 - no real output in console rusma Installing & Upgrading 5 February 23rd, 2010 14:36
Capture screen as video honk Multimedia 2 November 12th, 2009 09:05
Kismet, no capture sources? raadu Web & Network Services 2 February 16th, 2009 21:11


All times are GMT +1. The time now is 00:02.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0