DelphiFAQ Home Search:

How to redirect stderr in Unix


comments2 comments. Current rating: 5 stars (1 votes). Leave comments and/ or rate it.


I forgot how to redirect stderr in Unix.


> will redirect stdout. Use the >& operator to redirect stderr:

rm >&junk

It works in the Windows shell too.

Content-type: text/html


2008-03-12, 15:16:36
anonymous from United States  
Actually its neither of the above.
1 = std out file descriptor
2 = std err file descriptor

so the following redirects stderr to a file named 'junk'

rm 2>junk

and the following redirects both stdout and stderr into a file named junk

rm 1>junk 2>&1

the >& says to use the same file used by '1'
2017-06-02, 03:46:29
Joleen from Taiwan  
I have read so many posts about the blogger lovers however this article is actually a good piece of writing, keep it



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: