Linux – Pipe output from two commands into one

bashlinuxunix

Is it possible in unix/bash to pipe output from two commands into another?

I tried running the following command, which successfully ran both commands, but the first was piped to stdout and the second was piped to less.

$ grep 40515575 * && zgrep 40515575 * | less

Best Answer

Try this instead:

$ ( grep 40515575 * && zgrep 40515575 * ) | less