A filter command is almost any command line program on UNIX, really.
Every program that can read from
STDINand output to
STDOUT can be used as filter.
There are exceptions, though. One such exception is
cpio, which takes a list of files from
STDIN to create an archive on output.
There are some commands, that seem not to be able to read from
STDIN, though you should check whether those commands use
- as file parameter to read from
STDIN or write to
$ cat f - g
Output f’s contents, then standard input, then g’s contents.
But even when your program does not use that, you can still usually force a program to act as a filter:
For instance take
wget and you want to make that program output to
$ wget -O /dev/stdout http://stackoverflow.com/ | less
i.e.: You can use
/dev/stderr, as files to force a program to read, or output into the standard-IO descriptors.
Another side note: The length of your pipe, can be as long as you wish, so you can pipe from one program to another, basically making it a long chain of filters:
$ cat file | xz | ccrypt &>/dev/null