Click to See Complete Forum and Search --> : Command line to get output on a file
satimis
06-24-2005, 04:42 AM
Hi folks,
On Konsole window I started Gnomemeeting with;
$ LC_ALL=C gnomemeeting -d4
and then connected it to a remote self-testing site on Gnomemeeting device. All output were printed on the Konsole window.
I tried with following command line in anticipation to get the output to a file without success;
$ LC_ALL=C gnomemeeting -d4 > /path/to/record.txt.
Only an empty file was created. Please advise what will be the correct command line to be used.
TIA
B.R.
satimis
ph34r
06-24-2005, 08:50 AM
There are 2 output streams - stdout and stderr. The redirect you used was just for stdout. Try
LC_ALL=C gnomemeeting -d4 1> stdout.log 2> stderr.log
stdout.log should still be empty, stderr.log should have all your stuff in it.
satimis
06-24-2005, 11:26 AM
Hi ph34r,
Tks for your advice.
LC_ALL=C gnomemeeting -d4 1> stdout.log 2> stderr.log
stdout.log should still be empty, stderr.log should have all your stuff in it.Why stdout.log is empty?
I tried following command lines respectively to get printout displayed on Konsole
$ LC_ALL=C gnomemeeting -d4 '1> | tee /home/satimis/Working/stdout.log' '2> tee /home/satimis/Working/stderr.log'
$ LC_ALL=C gnomemeeting -d4 1'> | tee /home/satimis/Working/stdout.log' 2'> tee /home/satimis/Working/stderr.log'
$ LC_ALL=C gnomemeeting -d4 `1> | tee /home/satimis/Working/stdout.log` `2> tee /home/satimis/Working/stderr.log`
printout continously displayed on Konsole but no files created. Please advise. TIA
B.R.
satimis
JThundley
06-24-2005, 11:56 AM
gnomemeeting &> logfile.log
Doing &> will redirect all output to a file.
gnomemeeting &> logfile.log
Doing &> will redirect all output to a file.
That would output to a file all? including errors?
I know that to output all (including errors) you have to:
gnomemeeting > logfile.log 2>&1
JThundley
06-24-2005, 06:44 PM
That would output to a file all? including errors?
yep :D
command > file is for stdoutput
command 2> file is for stderr
command 2>&1 redirects stderr to stdout
command &> redirects both stdout and stderr to a file.
from man bash:
Redirecting Standard Output and Standard Error
Bash allows both the standard output (file descriptor 1) and the standard error output (file descriptor 2) to be redirected to
the file whose name is the expansion of word with this construct.
There are two formats for redirecting standard output and standard error:
&>word
and
>&word
Of the two forms, the first is preferred. This is semantically equivalent to
>word 2>&1
satimis
06-25-2005, 02:58 AM
HI JThundley,
Tks for your advice.
command > file is for stdoutput
command 2> file is for stderr
command 2>&1 redirects stderr to stdout
command &> redirects both stdout and stderr to a file.all worked except;
command 2>&1
"2>&1" has to be placed at the end of the command line
$ LC_ALL=C gnomemeeting -d4 > /path/to/stdout_to_stderr.log 2>&1
B.R.
satimis
satimis
06-25-2005, 03:07 AM
Hi folks,
What will be the correct syntax to have the stdout.log and stderr,log created in separate files while the printout still displaying on Konsole
I tried follows;
1)
$ LC_ALL=C gnomemeeting -d4 2>&1 | tee /path/to/stdout_to_stderr.log
It worked, printout displaying on Konsole, but only one file created.
2)
$ LC_ALL=C gnomemeeting -d4 1> /path/to/stdout.log 2> /path/to/stderr.log
2 files created without printout on Konsole window.
TIA
B.R.
satimis
Hm... I'm not sure if you can still display it on the console if you're redirecting its output..
You could do something like:
$ LC_ALL=C gnomemeeting -d4 1> /path/to/stdout.log 2> /path/to/stderr.log && cat /path/to/stdout.log
But that's just a work-around.
jacobb
06-25-2005, 04:56 PM
I'd do it like so:
$ cmd 1>stdout.log 2>stderr.log & tail -f stdout.log stderr.log
Then you get the output in real time.
satimis
06-26-2005, 09:37 AM
Hi jacobb,
Tks for your advice.
$ cmd 1>stdout.log 2>stderr.log & tail -f stdout.log stderr.logIt worked for me here.
B.R.
satimis