Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 02-09-2007, 05:58 AM   #1
Registered: Oct 2005
Distribution: Ubuntu 12.04 X86_64
Posts: 960

Rep: Reputation: 35
copying stdout and stderr to seperate files

i want to run a script that creates large quantaties sdtout and posts errors to sterr putting these into 2 seperare files, (eg stdout.txt and stderr.txt) (extentions only for conviniance!)

however i also want thease to do to stdout and std error on the screen.

i have been using "tee" to do this ie.
command | tee [filename]
but this doesnt do anything with stderr (which is more impiortant that stdout)

what would be the best way to do this?
Old 02-09-2007, 06:13 AM   #2
Registered: Apr 2004
Location: India
Distribution: Redhat,Fedora
Posts: 430

Rep: Reputation: 39
command 2>&1 | tee filename

This will redirect standard error into stdout.
So the file will have both
Old 02-09-2007, 06:41 AM   #3
Registered: Jun 2006
Distribution: Ubuntu 7.04 Feisty
Posts: 79

Rep: Reputation: 15
redirect your stderr to stdout using
2>&1 like
echo "hi" 2>&1  | tee -a a.txt;


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
TCSH: redirect stdout and stderr seperately ugenn Linux - General 3 02-07-2016 03:23 PM
send stderr to a file and also to stdout pranavchoudhary Linux - Newbie 7 08-25-2008 01:57 AM
redirecting stdout to /dev/null and stderr to stdout? Thinking Programming 1 05-18-2006 02:36 AM
redirecting stdout and stderr to a file Avatar33 Programming 4 03-12-2005 07:55 AM
Reopen the stdout and stderr rahul_kulkarni Programming 3 02-21-2005 06:55 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:10 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration