Hiding stderr or stdout

To hide the standard error (stderr) or standard output (stdout) messages produced by a program, redirect them to /dev/null, a special file that swallows all data written to it.

Hide stdout:

the_program > /dev/null

(Shorthand for the_program 1> /dev/null)

Hide stderr:

the_program 2> /dev/null

Hide stdout and stderr:

the_program &> /dev/null  


Last modified: 10/03/2012 Tags:

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top