Friday, July 25, 2014

Filters in Linux/Unix

  • A filter is a command that processes an input stream of data to produce an output stream of data.
  • Command lines which use a filter will include a pipes to connect it to the stdout of one process and the stdin of another process.
  • For example, the command line below takes the output of "who" and sorts it. The sorted output is then passed to the lp command for printing. In this example, sort is a filter.
         who  |  sort  | lp
  • Both filters and pipes demonstrate a basic UNIX principle: Expect the output of every program to become the input of another, yet unknown, program to combine simple tools to perform complex tasks



Post a Comment