>Pipes_
The
It is common to see the commands
Example: lists all processes with your username
pipes
, which in the shell are represented with the symbol | ,
are used to join two commands on the terminal, taking the output of the first
command and using it as input of the second.It is common to see the commands
grep
and ps
together,
an example below.Example: lists all processes with your username
ps aux | grep userExample: count the lines of a file, using the nl command
cat example1.txt | nl 1 Car 2 Computer 3 Robot 4 Smartphone 5 VideogameExample: passing expressions to bc to do calculations
echo "(12 / 2 - 3) * 3 + 1.5" | bc 10.5You can use the commands that you learned and put them together, always respecting the logic of the command.