Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Environment and Redirection Pipes and Redirection

What is standard error? What is 2> and how does it relate to standard error?

2 Answers

Steven Parker
Steven Parker
231,269 Points

:point_right: The stream number of the standard error stream is 2.

So putting "2>" on the command line will redirect the standard error output without affecting the normal output.

Steven Parker : So are all the "Permission Denied" 's all considered "standard errors"? I'm not sure what a standard error even is.

Steven Parker
Steven Parker
231,269 Points

:point_right: What "standard error" is depends on the program.

But most properly written programs will send all normal output to the standard output stream (1), and any message indicating an error condition to the standard error stream (2).

You didn't indicate your exact command sequence, but a "Permission denied" is most likely a "standard error" message, but it might be issued by the shell itself and not the command in which case it would not be affected by redirection.

Remember to choose a "best answer" on your questions that have been answered to indicate the issue is closed to other readers.