stdout is the standard output stream, usually directed to the user's terminal, though it can also be directed to a file or another program.
By convention, text that is printed normally at a console goes through stdout including prompts and reports of bad interactive input, though if an internal error occurs, the program may (the program should) report the message to standard error.
stdout can be directed into a file using the > operator:
puts the output of ls into file1
The content of stdout can be stored in a variable using backticks (`):
scorpio:~ # export v=`echo hallo` scorpio:~ # echo $v hallo scorpio:~ #
The output of echo has been placed into the variable $v.
The content of stdout can be stored in a variable using the cascadable $() operator:
scorpio:~ # export v=$(ll $(ls /bin/bash)) scorpio:~ # echo $v -rwxr-xr-x 1 root root 501804 Apr 23 03:46 /bin/bash scorpio:~ #
scorpio:~ # echo "hello" | sed 's/hello/hi/' hi scorpio:~ #
Note that, in this example, echo does not write to the console, but to the input of sed. And sed does not take its input from the keyboard, but from the output of echo. sed 's/hello/hi/' means: replace "hello" by "hi".