mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Linux (https://www.mersenneforum.org/forumdisplay.php?f=39)
-   -   console output to txt file (https://www.mersenneforum.org/showthread.php?t=20508)

pepi37 2015-09-24 12:42

console output to txt file
 
I run mprime under console ( GUI -less) distro of Linux.
Then I stop mprime
How to save content of console ( and those lines which I cannot see) to text file.
I try this for last few hours and I cannot find answer
Once I found it and it was simple command, but now I cannot find it any more.
Any help?
Thanks

rogue 2015-09-24 12:44

[QUOTE=pepi37;411176]I run mprime under console ( GUI -less) distro of Linux.
Then I stop mprime
How to save content of console ( and those lines which I cannot see) to text file.
I try this for last few hours and I cannot find answer
Once I found it and it was simple command, but now I cannot find it any more.
Any help?
Thanks[/QUOTE]

Try using ">" to redirect the output.

pepi37 2015-09-24 12:46

[QUOTE=rogue;411177]Try using ">" to redirect the output.[/QUOTE]

give me 0 bytes txt file.

chalsall 2015-09-24 13:16

[QUOTE=pepi37;411178]give me 0 bytes txt file.[/QUOTE]

Try something like "mprime -d | tee mprime_log.txt".

This will write the output of mprime to STDOUT (read: the console) as well as the mprime_log.txt file.

Keep in mind that it is possible you saw the 0 bytes because of buffering; the "-d" debugging flag increases the output from mprime.

Xyzzy 2015-09-24 13:21

[CODE]./mprime -d >> /path/to/file/filename &[/CODE]Optionally, prepend "nohup" to the line to prevent the process from being killed if you close the terminal session.

You can view the file "in real time" with:

[CODE] tail -f /path/to/file/filename[/CODE]

pepi37 2015-09-24 14:09

[QUOTE=chalsall;411179]Try something like "mprime -d | tee mprime_log.txt".

This will write the output of mprime to STDOUT (read: the console) as well as the mprime_log.txt file.

Keep in mind that it is possible you saw the 0 bytes because of buffering; the "-d" debugging flag increases the output from mprime.[/QUOTE]

Why dont you first read my post before answer it.
Mprime has been stopped!
So I wont all text that mprime produced while it was working send to some file for reading.

Dubslow 2015-09-24 20:02

[QUOTE=pepi37;411182]Why dont you first read my post before answer it.
Mprime has been stopped!
So I wont all text that mprime produced while it was working send to some file for reading.[/QUOTE]

Notice how `mprime` is in the command he suggests?

Fundamentally, there is no way to get text from the terminal's stdout after the fact.

Re-read the above line, to be extra sure.

Now, having absorbed that, the question as you seem to demand it be answered, cannot be answered. Instead, you must specify in some way, when you *start* mprime, that you want to save the text. His suggestion is arguably the best way to do so.

pepi37 2015-09-24 21:06

[QUOTE=Dubslow;411200]Notice how `mprime` is in the command he suggests?

Fundamentally, there is no way to get text from the terminal's stdout after the fact.

Re-read the above line, to be extra sure.

Now, having absorbed that, the question as you seem to demand it be answered, cannot be answered. Instead, you must specify in some way, when you *start* mprime, that you want to save the text. His suggestion is arguably the best way to do so.[/QUOTE]

And I am sorry, but that is not true. As I say at my first post, I manage to do exactly what I need to do at same situation. And I will find way: if it was first time it will be on second also. It must be some kind of framebuffer where Linux as OS writes what is text in console.
Will find way..
Thanks for answers

chalsall 2015-09-24 21:37

[QUOTE=pepi37;411202]And I am sorry, but that is not true. As I say at my first post, I manage to do exactly what I need to do at same situation. And I will find way: if it was first time it will be on second also. It must be some kind of framebuffer where Linux as OS writes what is text in console.
Will find way..
Thanks for answers[/QUOTE]

As we say here in Bim, Cheese on Bread (young children say this so they aren't slapped for being blasphemous)!

If you happen to have a GUI shell showing STDOUT, you can copy-and-paste the output.

Only idiots rely on that.

Dubslow 2015-09-24 21:41

There might be some OS-level tty logging somewhere... But I doubt it.

science_man_88 2015-09-24 21:56

my two cents: [url]http://stackoverflow.com/questions/30947971/prevent-program-from-closing-when-console-window-closes[/url] comes up when you google search console to text file after console closes ( no quotes) but it's about windows.


All times are UTC. The time now is 08:30.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.