Thread: recording stdout to a file

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    596

    recording stdout to a file

    (Not exactly a programming question.)

    Working in unix interactively, I remember that there was a command that allowed everything that was being written to the screen to also be saved in a file, but I can't remember the name of the command.

    (I don't mean redirecting output of a single command. This was something that, once executed, all subsequent activity on the screen is recorded to a file, until some other key combination ended it.)

    What's the mystery command?

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    596
    hah!

    I finally remembered.

    If anyone's interested, the command is "script".

  3. #3
    still a n00b Jaguar's Avatar
    Join Date
    Jun 2002
    Posts
    187
    What is that command? I am curious.
    slackware 10.0; kernel 2.6.7
    gcc 3.4.0; glibc 2.3.2; vim editor
    migrating to freebsd 5.4

  4. #4
    template<typename T> threahdead's Avatar
    Join Date
    Sep 2002
    Posts
    214
    neat program, not too hard to code though.

  5. #5
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    i dunno, mabey it has something to do with the stdout redirector,
    ls -l > log.log
    I don't know how to make it stay on after the program is finished though.
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

  6. #6
    template<typename T> threahdead's Avatar
    Join Date
    Sep 2002
    Posts
    214
    when you want to code that program, i suppose its nothing more than opening the STDOUT_FILENO && STDIN_FILENO for reading from it until some special command is received.
    all the data read in can be printed to a file.

  7. #7
    Registered User
    Join Date
    Feb 2003
    Posts
    596
    Sorry, been away for a few days.

    Just enter

    script [yourfilename]

    at the command line.

    From that moment on, everything that appears on the terminal screen is also saved to [yourfilename], until you hit control-d to end the script. Now you have a record of everything that appeared on the screen saved to the file that you specified.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File being filled with NULLs
    By Tigers! in forum Windows Programming
    Replies: 2
    Last Post: 06-30-2009, 05:28 PM
  2. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  3. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  4. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM