Recording Terminal to a .txt file
So I have a terminal session open to keep some stuff going for upwards of 10 hours of a time and I need a way to record the information outputted in the terminal to a text file as it is running. That means no stopping the script, just recording what the script says as it is running.
Is it possible?
If so, how would I go about it?
Re: Recording Terminal to a .txt file
Quote:
Originally Posted by
Carbonwyre
So I have a terminal session open to keep some stuff going for upwards of 10 hours of a time and I need a way to record the information outputted in the terminal to a text file as it is running. That means no stopping the script, just recording what the script says as it is running.
Is it possible?
If so, how would I go about it?
Code:
scriptname > /location/textfile
it is the same in Windows also,. incase you wanted to know, although the solidus is primarily a Linux thing, and \ is used in Windows, contrary to popular belief you can still use a solidus for filepaths in Windows
Re: Recording Terminal to a .txt file
Redirect the command or script using .txt file.
Ex) ls> output.txt 2>&1
Re: Recording Terminal to a .txt file
Quote:
Originally Posted by
haqking
Code:
scriptname > /location/textfile
it is the same in Windows also,. incase you wanted to know, although the solidus is primarily a Linux thing, and \ is used in Windows, contrary to popular belief you can still use a solidus for filepaths in Windows
So simply XXXXX.sh >/pathtofile/file ?
Re: Recording Terminal to a .txt file
Quote:
Originally Posted by
Carbonwyre
So simply XXXXX.sh >/pathtofile/file ?
well that was what i wrote ;-)
For further reading to assist try this http://www.tuxfiles.org/linuxhelp/iodirection.html
Re: Recording Terminal to a .txt file
Quote:
Originally Posted by
haqking
Thanks ^_^ for a new using sometimes it's hard to wrap my head around some things. So even though I might read it 3-4 times elsewhere I still have to ask just to make sure I'm not typing 1 things wrong and confusing myself forever.
Re: Recording Terminal to a .txt file
Quote:
Originally Posted by
Carbonwyre
Thanks ^_^ for a new using sometimes it's hard to wrap my head around some things. So even though I might read it 3-4 times elsewhere I still have to ask just to make sure I'm not typing 1 things wrong and confusing myself forever.
No problem, please mark the thread as solved using thread tools to help others when searching.
Cheers
Re: Recording Terminal to a .txt file
Quote:
Originally Posted by
haqking
No problem, please mark the thread as solved using thread tools to help others when searching.
Cheers
I just tried out the command and the recorded document looks like
Quote:
208
27
>
>
>
>
>
>
>
>
>
>
>
>stop
>
>
>
>
And that's the short version. The problem is that the script actually put out quite a bit of information but it wasn't recorded.
The information is outputted from a Java Runtime and most the information is coming from the runtime not the script itself. It is displayed in the terminal but not generated by the terminal.
Any advice?
Re: Recording Terminal to a .txt file
Perhaps some of the script was sending data to stderr in addition to stdout. You can try capturing both.
Code:
scriptname > /location/textfile 2>&1
You can also use the script utility to record a session.
Re: Recording Terminal to a .txt file
Quote:
Originally Posted by
Lars Noodén
Perhaps some of the script was sending data to stderr in addition to stdout. You can try capturing both.
Code:
scriptname > /location/textfile 2>&1
You can also use the
script utility to record a session.
I tried out the script utility first and it works ^_^ Thank you both :D I'm sure these questions get tiring to answer after 5k posts.