The | operator makes bash redirect all data that the command left of it returns to the stdout
Let’s try a more complex example.
If you want to see the data and write to the file passed on between programs in a pipe, you can insert the tee command.
1 | $ps aux | tee filename | grep root |
The data shown by ps aux is written by tee to file named filename and is piped to grep to show only the root expression.
The command xargs can feed arguments, usually imported through a pipe, to a command.
The next example will show how to use xargs.
1 | $ ls -l | xargs echo {} |
The command ls -l show the files and folders.
The output is piped by | to the xargs.
The command xargs will execute echo {}.
The {} will be replaced by xargs with the argument, in this case with the output piped by ls -l.