---

Learn Linux, 101: Text streams and filters

[ Thanks to An Anonymous Reader for
this link. ]

“Text filtering
Text filtering is the process of taking an input stream of text and
performing some conversion on the text before sending it to an
output stream. Although either the input or the output can come
from a file, in the Linux and UNIX® environments, filtering is
most often done by constructing a pipeline of commands where the
output from one command is piped or redirected to be used as input
to the next. Pipes and redirection are covered more fully in the
article on streams, pipes, and redirects (which you can find in the
series roadmap), but for now, let’s look at pipes and basic output
redirection using the | and > operators.

“Streams
A stream is nothing more than a sequence of bytes that can be read
or written using library functions that hide the details of an
underlying device from the application. The same program can read
from, or write to a terminal, file, or network socket in a
device-independent way using streams. Modern programming
environments and shells use three standard I/O streams:

“stdin is the standard input stream, which provides input to
commands.

“stdout is the standard output stream, which displays output
from commands.

“stderr is the standard error stream, which displays error
output from commands.”


Complete Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis