Consider:mkfifo /tmp/out1mkfifo /tmp/in2cat /tmp/out1 > /tmp/in2 &When I runps it appears as bash in the CMD section.Why?
Why does cat /tmp/out1 > /tmp/in2 & appear as bash with the ps command?
bash;shell;io redirection;ps;fifo
ps lists bash as the running process because the bash process is blocked trying to open the fifo /tmp/in2 before spawning the cat command.  Since bash is responsible for handling your redirect(> /tmp/in2), it must first open /tmp/in2 so that it can later use the dup2 system call to change the STDOUT of the cat command to the file descriptor for /tmp/in2.  Unfortunately, the call to open is blocking in this case.If you were to run the command inside strace:strace -f bash -c cat /tmp/out1 > /tmp/in2you would see it stop at:[pid 18457] open(/tmp/in2, O_WRONLY|O_CREAT|O_TRUNC, 0666It is blocked until another process opens the file for reading.  According to the fifo(7) man page:The kernel maintains exactly one pipe object for each FIFO special file that is opened by at least one process. The FIFO must be opened on both ends (reading and writing) before data can be passed. Normally, opening the FIFO blocks until the other end is opened also.A process can open a FIFO in nonblocking mode. In this case, opening for read only will succeed even if no-one has opened on the write side yet, opening for write only will fail with ENXIO (no such device or address) unless the other end has already been opened. If you were to open /tmp/in2 for reading first (say by adding cat /tmp/in2 & before your final cat command), you would see your final cat command show up in your process tree.