As I understand pipes and commands, bash takes each command, spawns a process for each one and connects stdout of the previous one with the stdin of the next one.For example, in ls -lsa | grep feb, bash will create two processes, and connect the output of ls -lsa to the input of grep feb.When you execute a background command like sleep 30 & in bash, you get the pid of the background process running your command.Surprisingly for me, when I wrote ls -lsa | grep feb & bash returned only one PID. How should this be interpreted? A process runs both ls -lsa and grep feb? Several process are created but I only get the pid of one of them?
PID background process
bash;process;background process
Spawns 2 processes.  The & displays the PID of the second process.  Example below.$ echo $$13358$ sleep 100 | sleep 200 &[1] 13405$ ps -ef|grep 13358ec2-user 13358 13357  0 19:02 pts/0    00:00:00 -bashec2-user 13404 13358  0 19:04 pts/0    00:00:00 sleep 100ec2-user 13405 13358  0 19:04 pts/0    00:00:00 sleep 200ec2-user 13406 13358  0 19:04 pts/0    00:00:00 ps -efec2-user 13407 13358  0 19:04 pts/0    00:00:00 grep --color=auto 13358$