Understanding I/O redirection in the command line
We have already run several commands to ascertain information about the system, such as listing files with ls
, and we have got some information, output, from the running command, including, for example, filenames and file sizes. That information, or output, can be useful, and we want to be able to work with it, store it, and manage it properly.
When talking about command output and also input, there are three sources or targets for them that need to be understood:
- STDOUT: Also known as Standard Output, this is where commands will put their regular messages to provide information on what they are doing. In a terminal, on an interactive shell (like the ones we are using so far), this output will show on screen. This will be the main output managed by us.
- STDERR: Also known as Standard Error, this is where the commands will put their error messages to be processed. In our interactive shells, this output will also be shown...