Uploaded March 2019 | Updated September 2026, 11 hours ago
Stderr Stdout and Stdin - How to Redirect them - Commands for Linux
This video will show you how to redirect standard input, standard output and standard error also known as the standard streams. Throughout this video we go over redirecting standard error( stderr ) and standard output ( stdout ) to files so that you can have both outputting to the same file or separate files. We also cover redirecting stdin.
There are many reasons to redirect stdout and stderr. An example of this would be
you are dealing with a program or utility that spams a large amount of output to the screen but you are only interested in error to diagnose some problem. You could trawl through the output searching for errors, but this is time consuming it
would be a much better idea for you to just redirect stdout to /dev/null and you will be left with only error displayed within your terminal.
Redirection of these three standard file descriptors is common to see in bash scripts along with using exec to make your own file descriptors and is just another handy tool to have at your disposal.
Just remember if you are redirecting stdout, stderr or both to a file and you want to keep the output from previous redirection make sure you append with double greater than signs as this will stop you from clobbering data that was previously written to your file.
Subscribe: youtube.com/user/linuxleech?sub_confirmation=1
Blog: linuxleech.com
Twitter: twitter.com/linuxleech
Facebook: facebook.com/linuxleech
Stderr Stdout and Stdin - How to Redirect them - Commands for Linux
This video will show you how to redirect standard input, standard output and standard error also known as the standard streams. Throughout this video we go over redirecting standard error( stderr ) and standard output ( stdout ) to files so that you can have both outputting to the same file or separate files. We also cover redirecting stdin.
There are many reasons to redirect stdout and stderr. An example of this would be
you are dealing with a program or utility that spams a large amount of output to the screen but you are only interested in error to diagnose some problem. You could trawl through the output searching for errors, but this is time consuming it
would be a much better idea for you to just redirect stdout to /dev/null and you will be left with only error displayed within your terminal.
Redirection of these three standard file descriptors is common to see in bash scripts along with using exec to make your own file descriptors and is just another handy tool to have at your disposal.
Just remember if you are redirecting stdout, stderr or both to a file and you want to keep the output from previous redirection make sure you append with double greater than signs as this will stop you from clobbering data that was previously written to your file.
Subscribe: youtube.com/user/linuxleech?sub_confirmation=1
Blog: linuxleech.com
Twitter: twitter.com/linuxleech
Facebook: facebook.com/linuxleech










