Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Here's my situation: I open terminal and run program which displays live feed in terminal (text) what changes every second. Only "Enter" key can be used while this program is running (it exits that program). So you can't type anything else into console.

I would like to write that terminal contents into a file, like after every second.

How do I do it? By opening 2nd console and using some command? Can't get it work with setterm -dump command.

share|improve this question
    
Hm, which application is this? If you haven't checked well, you should make sure if the application has an option to save the ouput somewhere. –  Wolter Hellmund Mar 26 '11 at 9:25
    
Did check that. It doesn't. Otherwise I wouldn't have this problem. Program is live-f1, launchpad.net/live-f1 –  Gustav Mar 26 '11 at 10:28
add comment

3 Answers 3

You can pipe your output to the tee program (description):

my_program ... | tee my_program.log

This will show the ouput on the terminal, but also write it to the file my_program.log

share|improve this answer
    
Same result like with 1st answer. :/ –  Gustav Mar 26 '11 at 8:20
    
The screenshot you posted looks like it has a lot of terminal escape sequences in it. From the launchpad info, it uses ncurses (I downloaded the source with bzr branch lp:live-f1, then went looking in the README). Can you run the program without colors by setting TERM to dumb (export TERM=dumb)? The source also has a TODO file, noting on the wishlist to keep a history of the drivers. Maybe you can contact the developers to see what they're planning or if they have a way for you to save results. –  steabert Mar 26 '11 at 11:19
add comment

When you are executing your command from terminal instead of seeing the output on your console you can redirect it straight to a file. While the program runs your the output is going to be written to the file. An example lets say you want to write the contents of your folder with an ls command to a file called list.txt

ls > list.txt

The > operator redirects your output according to your needs.

share|improve this answer
    
Thx, this works but partly. Content should be HTML, but when I open the file, it's something like this (snip from the file): VETTEL[21G(B[m[39;49m. Program's name is "live-f1". live-f1 > live_f1_dump.log –  Gustav Mar 26 '11 at 8:19
    
@Gustav you mean that in console it prints html and in the file the above lines? –  topless Mar 26 '11 at 9:02
    
Yes. This is what I get when I run your suggested command: upload.ee/image/1223166/ss_01.png. My goal is to get Formula 1 drivers' positions from live-f1 feed into a file. I got it work last year by running live-f1 program in 1st terminal, then firing up 2nd terminal and using some command what captured 1st terminal screen and saved it to a file (copy from last year's file: upload.ee/download/1223347/0b6545ce227661452c8/html.log). Command was something like that: tty "1st terminal pointer" "filename". Possible that it was something else that "tty" what I used for that. –  Gustav Mar 26 '11 at 10:34
add comment

Try using the script command. Unfortuantely, it puts a lot of control character gobbledegook in the transcript. However, if you see this link at the NCSSM CS Site you will find an imperfect but pretty good solution to the problem.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.