Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 04-05-2011, 07:54 AM   #1
LQ Newbie
Registered: Apr 2011
Posts: 1

Rep: Reputation: 0
bash output stderr to 2 files and stdout

I want to output the stdout and stderr in a logfile,
moreover i do want to log stderr also to a separate logfile, and print str to the screen

I searched arround and tried:

$ command 2>&1 > log | tee -a log log.err
But then in log first the stdout appears, and then stderr.
Old 04-05-2011, 08:04 AM   #2
LQ Guru
Registered: Apr 2005
Posts: 5,818

Rep: Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003
2>&1 redirects stderr to stdout, whereas &> redirects both stderr and stdout to file. That being said:
2> file.txt
That will redirect stderr to a seperate file. Hope that helps.




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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
redirecting stdin, stdout and stderr, and finding files name and other stats wroom Programming 4 08-14-2010 06:48 AM
libxml2: removing output on stdout/stderr VincOx Programming 4 07-28-2010 02:40 AM
Can't seem to catch some output from a program - not stdout or stderr. uhh.. help? BrianK Programming 2 01-30-2010 11:53 AM
bash logging stdout plus stderr freeindy Programming 6 01-29-2009 09:16 AM
copying stdout and stderr to seperate files dasy2k1 Linux - General 2 02-09-2007 06:41 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:53 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