Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If i am running some program, say make, and want all that is printed to stderr(but not stdout) also to go to a file (and get printed on the stdout as well), how do i do it?
I found 'tee', bit i am looking for its stderr counterpart!!
If you don't need the stdout messages, you could do:
Code:
make 2>&1 >/dev/null | tee your_file
Note that the order (ie first 2>&1) is important: 2>&1 must be put BEFORE >/dev/null, otherwise your error messages will be sent to /dev/null.
Alternatively, you might consider named FIFO pipes. See "man mkfifo".
And there is no "stderr counterpart" to tee. tee just copies whatever it gets on it's stdin to it's stdout and to a file. What it gets on it's stdin can come from anywhere (another programs stdout, stderr, a file, ...).
Show normal text on screen,
Show error text on screen,
Put error text in file.
This is done by reassigning your file descriptors stdout will become stderr and stderr will become stdout. tee (which only works in stdout) will put the reassigned stderr to file.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.